What's new
  • 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!

wan-start userscript not working

ripdog

New Around Here
So I'm trying to get my router to automatically update my IP with unotelly when a connection is established. I can't figure out why it doesn't work, though...

Code:
admin@router:/jffs/scripts# cat wan-start
#! /bin/bash
touch /tmp/000wanstarted
#sh /jffs/scripts/tunnelupdate.sh
sh unotelly.sh

admin@router:/jffs/scripts# ls -la
drwxr-xr-x    2 admin    root             0 Jun 26 00:53 .
drwxr-xr-x    5 admin    root             0 Jun 26 01:01 ..
-rwxrwxrwx    1 admin    root          1299 May  1 03:58 tunnelupdate.sh
-rwxrwxrwx    1 admin    root           148 May  1 19:18 unotelly.sh
-rwxrwxrwx    1 admin    root            87 Jun 26 00:41 wan-start

admin@router:/jffs/scripts# ./wan-start
-sh: ./wan-start: not found

When I run
Code:
sh wan-start
It works fine. However, ./wan-start doesn't work, and the router doesn't run the script by itself. My connection is plain old DHCP over fibre, with a cloned MAC address for authentication.
 
So I'm trying to get my router to automatically update my IP with unotelly when a connection is established. I can't figure out why it doesn't work, though...

Code:
admin@router:/jffs/scripts# cat wan-start
#! /bin/bash
touch /tmp/000wanstarted
#sh /jffs/scripts/tunnelupdate.sh
sh unotelly.sh

admin@router:/jffs/scripts# ls -la
drwxr-xr-x    2 admin    root             0 Jun 26 00:53 .
drwxr-xr-x    5 admin    root             0 Jun 26 01:01 ..
-rwxrwxrwx    1 admin    root          1299 May  1 03:58 tunnelupdate.sh
-rwxrwxrwx    1 admin    root           148 May  1 19:18 unotelly.sh
-rwxrwxrwx    1 admin    root            87 Jun 26 00:41 wan-start

admin@router:/jffs/scripts# ./wan-start
-sh: ./wan-start: not found

When I run
Code:
sh wan-start
It works fine. However, ./wan-start doesn't work, and the router doesn't run the script by itself. My connection is plain old DHCP over fibre, with a cloned MAC address for authentication.

try replacing the first line with:

Code:
#!/bin/sh

Regards,
 
Oh wow, it's really obvious in retrospect. Thanks a lot, mate! Works good from command line now, should work on connection too, let's hope. Thanks again!
 
Unfortunately my optimism was misplaced. All /bin/bash's were replaced with /bin/sh, and ./wan-start works now, but script still fails to fire when wan starts. I added logger lines to more easily tell when the script is run, but no luck.

Would love any additional ideas on getting this working.
 
Hey condor, could you post the output of ls -lah in /jffs/scripts? Just to make sure it's not an ownership/permissions issue.
 
sure:

admin@Router:/jffs/scripts# ls -la
drwxr-xr-x 2 admin root 0 Apr 23 00:40 .
drwxr-xr-x 5 admin root 0 Jan 1 1970 ..
-rwxrwxrwx 1 admin root 248 May 3 00:51 firewall-start
-rwxrwxrwx 1 admin root 458 May 3 00:08 init-start
-rwxrwxrwx 1 admin root 75 Jan 13 00:42 post-mount
-rwxrwxrwx 1 admin root 53 Jan 13 00:42 services-start
-rwxrwxrwx 1 admin root 43 Jan 13 00:42 services-stop
-rwxrwxrwx 1 admin root 132 Apr 23 00:57 wan-start


Thanks!
 
So I'm trying to get my router to automatically update my IP with unotelly when a connection is established. I can't figure out why it doesn't work, though...

Code:
admin@router:/jffs/scripts# cat wan-start
#! /bin/bash
touch /tmp/000wanstarted
#sh /jffs/scripts/tunnelupdate.sh
sh unotelly.sh

admin@router:/jffs/scripts# ls -la
drwxr-xr-x    2 admin    root             0 Jun 26 00:53 .
drwxr-xr-x    5 admin    root             0 Jun 26 01:01 ..
-rwxrwxrwx    1 admin    root          1299 May  1 03:58 tunnelupdate.sh
-rwxrwxrwx    1 admin    root           148 May  1 19:18 unotelly.sh
-rwxrwxrwx    1 admin    root            87 Jun 26 00:41 wan-start

admin@router:/jffs/scripts# ./wan-start
-sh: ./wan-start: not found

When I run
Code:
sh wan-start
It works fine. However, ./wan-start doesn't work, and the router doesn't run the script by itself. My connection is plain old DHCP over fibre, with a cloned MAC address for authentication.

Try;

chmod +x wan-start
 
All /bin/bash's were replaced with /bin/sh, and ./wan-start works now, but script still fails to fire when wan starts. I added logger lines to more easily tell when the script is run, but no luck.
So are you saying that wan-start isn't running at all (no logger entries in syslog), or that it is running but not doing anything?

BTW: Don't use this in your script
Code:
sh unotelly.sh
Use this:
Code:
/jffs/scripts/unotelly.sh
 
So are you saying that wan-start isn't running at all (no logger entries in syslog), or that it is running but not doing anything?

BTW: Don't use this in your script
Code:
sh unotelly.sh
Use this:
Code:
/jffs/scripts/unotelly.sh

It's not running at all. It works fine when i run it myself.
 
It's not running at all. It works fine when i run it myself.

I can confirm that is not running, unless I launch the script from the terminal by myself.

So do you see the WAN interface message in the syslog?
Code:
# grep -i wan /tmp/syslog.log
Jan  1 00:00:08 syslog: module qmi_wwan not found in modules.dep
Jan  1 00:00:08 WAN Connection: ISP's DHCP did not function properly.
Jan  1 00:00:12 wan-start: 0
Jan  1 00:00:13 WAN Connection: WAN was restored.
 
here's what I have in the log:

Jan 1 01:00:08 syslog: module qmi_wwan not found in modules.dep
Jan 1 01:00:09 WAN Connection: ISP's DHCP did not function properly.
Jan 1 01:00:14 WAN Connection: WAN was restored.
Jan 1 01:38:25 WAN Connection: Ethernet link down.
Jan 1 01:38:32 WAN Connection: Ethernet link up.
Jan 1 01:38:32 rc_service: wanduck 334:notify_rc restart_wan_if 0
Jan 1 01:38:42 rc_service: skip the event: restart_wan_if 0.
Jan 1 01:38:47 WAN Connection: ISP's DHCP did not function properly.
Jan 1 01:39:12 WAN Connection: The LAN's subnet may be the same with the WAN's subnet.
Jan 1 01:39:37 WAN Connection: ISP's DHCP did not function properly.
Jan 1 01:39:42 WAN Connection: WAN was restored.


thanks for the help!
 
Hi condor, I can't see anything obviously wrong.

Can you change your /jffs/scripts/wan-start file so that it contains only these 2 lines:
Code:
#!/bin/sh
logger -t $(basename $0) $1
Then reboot and show us the syslog like before.
 
I did the test and looks like I was wrong, according to the log the script was run:

Jan 1 01:00:08 syslog: module qmi_wwan not found in modules.dep
Jan 1 01:00:09 WAN Connection: ISP's DHCP did not function properly.
Jan 1 01:00:15 WAN Connection: WAN was restored.
Jul 2 22:01:08 wan-start: 0


So there must be something wrong in the script itself. If I launch it manually, I get the following result:

admin@Router:/tmp/home/root# /jffs/scripts/wan-start
Connecting to www.unotelly.com (108.61.44.139:80)
Connecting to api.unotelly.com (64.237.43.124:80)
updateip.php?user_ha 100% |*******************************| 11 0:00:00 ETA


and the IP at unotelly website is updated successfully. If I reboot the router or the modem I see the entry in the log but the IP is NOT updated. There's only the wget in the script, nothing else, I really don't know what could be the issue :(
 
Try putting the full path to wget in the script....

/usr/bin/wget
And if that doesn't work try changing this
Code:
wget -O- -s http://www.unotelly.com/unodns/auto_auth/hash_update/updateip.php?user_hash=xxxxxxxxxx
to this
Code:
wget -q -s http://www.unotelly.com/unodns/auto_auth/hash_update/updateip.php?user_hash=xxxxxxxxxx
Basically, the "-O-" becomes "-q".
 

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

Back
Top