Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Retrieve home IP address remotely via email' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Retrieve home IP address remotely via email
Authored by: bluehz on May 11, '04 12:22:51AM

Not sure if this is the problem - but something you might want to look into. When running the script as a user - the ip.html is assumed to be created in the current working directory you are in. When running the script via cron - I don't think there is a current working directory so it may not know where to write the ip.html file. You might try putting in a full path for your ip.html like:

path=/var/tmp/ip.html

or something like that. Just a guess...



[ Reply to This | # ]
Retrieve home IP address remotely via email
Authored by: overrider on May 11, '04 02:26:55AM

Bluehz,

you are awesome, it worked flawlessly. So here for reference;

********
#!/bin/sh
ip=`curl -s http://www.whatismyip.com/ | grep '<h1>' | awk {print $4}'` page=/ip.html
echo "<html><head><title>Current IP</title></head>
<body bgcolor=white text=black>
Current IP Address: $ip<br>" > $page
date >> $page
echo '</b><br><br><PRE>' >> $page
echo '</a>' >> $page
echo '</body></html>' >> $page

echo Posting your WAN IP to the Server.....
ftp -nv ftp.server.com<< EOF
user uid pwd
put /ip.html /p35838597/ip.html
bye
******

I only added a "/" before the page.html, and it worked.Cron does not have a working directory, hence it doesnt know where to put the ip.html file. Hah, and i tried for ages to figure it out. Damn....

Thanks a whole lot for that fast reply!!!

Overrider



[ Reply to This | # ]