Monday, October 15, 2007

Notes to Self

I did not create the below files or scripts, it's more like I took them from the web see my prior ref here.

mybox@mybox-desktop:~$ cat .netrc
machine ftp-www.earthlink.net
login 1234@earthlink.net
password !@#$%^

mybox@mybox-desktop:~$ crontab -l
# m h dom mon dow command
01,31 * * * * /home/mybox/Scripts/up.sh


mybox@mybox-desktop:~/Scripts$ cat up.sh
#!/bin/bash
MyDate=`date`
MyIP=`curl -s http://myip.dk/ | egrep -m1 -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'`
echo $MyIP > ~/Scripts/.MyIP.now
if !(/usr/bin/diff ~/Scripts/.MyIP.now ~/Scripts/.MyIP.then) ; then
sed "s/~~~MyIP~~~/$MyIP/g ; s/~~~date~~~/$MyDate/g" ~/Scripts/index.html_source > ~/Scripts/index.html
echo -e "put index.html" | /usr/bin/ftp -v ftp-www.earthlink.net
cp ~/Scripts/.MyIP.now ~/Scripts/.MyIP.then
fi


mybox@mybox-desktop:~/Scripts$ cat index.html_source
<html>
<head>
<title>~~~MyIP~~~</title>
<meta http-equiv="Refresh" content="7;URL=http://~~~MyIP~~~/">
</head>

<body>
<p>
<p>

Good things come to those who wait 7 seconds...
<p>
you are being redirected to <a href="http://~~~MyIP~~~/">my basement server.</a>

<br><br>
</body>
<hr>
<p><i>Page last updated on ~~~date~~~</i></p>
<hr>
</html>

2 comments:

  1. You're giving away your source code, aren't you?

    ReplyDelete
  2. They aren't really mine. I took them from various sources and published them here mostly for my own reference. Because I tend to forget what I did too quickly.

    ReplyDelete

Barber Shop in Chinatown

 Nowadays I loathe to have my haircut, that's why I seldom have mine cut, maybe once or twice a year. I went back to Chinatown. I could ...