What's new

Hit a URL whenever WAN IP changes.. how to do this?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

bha

New Around Here
Hello all,

I have a need to hit the following URL whenever my WAN IP changes. Their service requires knowing my WAN IP and this is the best way to send them updates:

http://login.adfreetime.com/cron.php?email=username@domain.com

I have tried so many things but can't get it to update their URL. If I type the above into my browser (with my correct email address) I get a "Success!" message and when I go into self service on their website, it shows my new IP.

If I do it via a router script, it never updates their site.. not sure why..

Running 3.0.0.4.372.30_2

I have tried:
services-start script, with a wget command
dhcpc-event
wan-start
chmod a+rx every one of the above, still no change
tried setting it up as a cron job and the job shows up (even the events show up in my log) but doesn't work.

Is there something I'm missing? Seems to work from the command line.

And I have even tried to create a file as part of my script (TheScriptWorked) and that file appears but the wget didn't work.....

All I need to do is get that URL to run whenever the IP changes. I'm not picky.. even if I had to settle for doing it every hour I guess I could live with that (they cut you off if you update your IP too often but I think it has to be 50+ updates per day... they could handle one an hour)
 
Just a followup to my earlier post...

I'm thinking the simplest solution would be (if I could get it to work)
Enable/format JFFS (done)
Create wan-start script with the following lines:
wget (parameters) (URL)
logger -t "IP updated successfully"
chmod a+rx the above file
Reboot router

.. was gonna delete all of my scripts, reformat the JFFS and try again.. should the above work? What should the exact format of the wget line be (I remember a "-O" parameter in the line I used, and I also remember outputting to /dev/null because it otherwise was downloading a file and it would only work once before I got a 'file exists' error)
 
Just a followup to my earlier post...

I'm thinking the simplest solution would be (if I could get it to work)
Enable/format JFFS (done)
Create wan-start script with the following lines:
wget (parameters) (URL)
logger -t "IP updated successfully"
chmod a+rx the above file
Reboot router

.. was gonna delete all of my scripts, reformat the JFFS and try again.. should the above work? What should the exact format of the wget line be (I remember a "-O" parameter in the line I used, and I also remember outputting to /dev/null because it otherwise was downloading a file and it would only work once before I got a 'file exists' error)

This is my UnblockUS.sh script which is called from wan-start.

As shown in the script comments, I actually installed the entware version of wget as this seemed to be more reliable.


Code:
#!/bin/sh

logger -t "($(basename $0))" $$ Updating Unblock-US authentication

# Delete the files so we can see a creation timestamp to prove we ran!
echo `date` "FAILED to refresh Unblock-US"  > /tmp/mnt/RT-N66U/Unblock-us.log

# Remove 'active' from the status file so this should be an indicator in the email to perform a manual authentication
echo "Unknown - manual authentication required - http://www.unblock-us.com/" >/tmp/mnt/RT-N66U/Unblock-us-status

# Must use the entware version?
/tmp/mnt/RT-N66U/entware/bin/wget -o /tmp/mnt/RT-N66U/Unblock-us.log -O /tmp/mnt/RT-N66U/Unblock-us-status --no-check-certificate https://api.unblock-us.com/login?xxxxxxxxxxxxxx:ppppppppppppp

# Dump last entry from the log....
logger -t "($(basename $0))" $$ Status `tail -2 /tmp/mnt/RT-N66U/Unblock-us.log`

logger -t "($(basename $0))" $$ Unblock-US authentication complete

Regards,
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!

Members online

Top