Internet Disconnects daily; Wrote script to automatically reboot when this happens, but doesn't re-load on reboot. HELP

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

sherv

New Around Here
Story:
I have 3 Asus routers as my home network set in AIMesh configuration. The ISP is Hotwire fiber into garage low-voltage panel, and then the RT-AX88U (with 10 LAN ports to connect the wired connections in the house, as well as to the other 2 RT-AX56U's) serves as my Main Router.

As you guys know, there is a known issue with Asus Routers constantly disconnecting from internet and only reboot fixes this.... mainly due to DHCP query to ISP modem, which I've already tried to play with Ad Naseum (changed to "normal", then to "Continuous"... getting a static IP.... you name it :confused: ). Several threads about this including:
and I'm in the same boat as this guy:


ANYWAYS.... I don't want to install Merlin or DDWRT or anything, just keep the darn thing stock, or else pull everything out and just go with Unifi or something. But before doing that, I went ahead and did a modified simpler version of this technique which supposedly is a good alternative to automatically reboot when the WAN connnection is disrupted:

Here is what I've done:

Wrote a very basic Script (internetcheck.sh) to check WAN connection:
Code:
#!/bin/sh

logger -s CHECKING INTERNET CONNECTIION VIA SHERVIN SCRIPT

ping -c5 google.com

if [ $? -eq 0 ]; then
    date +"%Y-%m-%d %r - internet connection UP"
    logger -s Internet connection UP
else
    date +"%Y-%m-%d %r - internet connection DOWN ... REBOOT" >> /jffs/scripts/check.log
    logger -s Internet connection DOWN - REBOOT
    reboot
fi
and saved it to
/jffs/scripts/

Next, I created the init-start script to add it to the CRON jobs, and to run it every 5 mins:
Code:
#!/bin/sh

cru a internetcheck.sh "*/5 * * * * /jffs/scripts/internetcheck.sh"
and also saved it there in the same directory.

Changed the permissions and all looks good:
-rwxr-xr-x 1 ShervinA root 79 May 6 12:13 init-start
-rwxr-xr-x 1 ShervinA root 359 May 7 12:18 internetcheck.sh

Question 1: Does the init-start script look correct to run the check script every 5 mins?

The system log shows that it's indeed trying:
Code:
May  7 12:35:00 ShervinAsusRouter: CHECKING INTERNET CONNECTIION VIA SHERVIN SCRIPT
May  7 12:35:04 ShervinAsusRouter: Internet connection UP
May  7 12:40:00 ShervinAsusRouter: CHECKING INTERNET CONNECTIION VIA SHERVIN SCRIPT
May  7 12:40:04 ShervinAsusRouter: Internet connection UP
May  7 12:45:00 ShervinAsusRouter: CHECKING INTERNET CONNECTIION VIA SHERVIN SCRIPT
May  7 12:45:04 ShervinAsusRouter: Internet connection UP


Since there is no direct way to hook into a bootup script, But there is an option to run a script every time a USB drive is mounted, which happens on boot, I added this:
Code:
nvram set script_usbmount="/jffs/scripts/init-start"
nvram commit

Question 2: Isn't this supposed to make it load the init-start script at start up once the Router goes thru it's phase of mounting the USB drive???

When I manually add the job, it shows up fine:
[email protected]:/# cru l
*/5 * * * * /jffs/scripts/internetcheck.sh #internetcheck.sh#


but after a reboot, the script doesn't automatically show up! :mad:
[email protected]:/# cru l
[email protected]:/#


WHAT AM I MISSING???
 

bbunge

Part of the Furniture
What you are missing is that the Asus factory firmware does not auto run scripts. Merlin does.
There is a work around:

You will need a USB device inserted in the router

In a router terminal enter:
nvram set script_usbmount="/jffs/post-mount"
nvram commit

The script you want to activate is in a file called post-mount. In lieu of "/jffs/post-mount" you can use the file or path of your choice. Just set the file properties to 755.

Leave the USB device inserted into the router. Every time the router reboots the USB device will mount and trigger the script.
 

sherv

New Around Here
What you are missing is that the Asus factory firmware does not auto run scripts. Merlin does.
There is a work around:

You will need a USB device inserted in the router

In a router terminal enter:
nvram set script_usbmount="/jffs/post-mount"
nvram commit

The script you want to activate is in a file called post-mount. In lieu of "/jffs/post-mount" you can use the file or path of your choice. Just set the file properties to 755.

Leave the USB device inserted into the router. Every time the router reboots the USB device will mount and trigger the script.

ahhhhh.... darn, it's always some simple silly thing I miss! DOH

ok, great, I will put a USB thumb drive in there, and hopefully this will trigger it. I'll keep you guys posted
 

SomeWhereOverTheRainBow

Part of the Furniture
ahhhhh.... darn, it's always some simple silly thing I miss! DOH

ok, great, I will put a USB thumb drive in there, and hopefully this will trigger it. I'll keep you guys posted
you could skip the flash drive method and do
nvram set jffs2_exec="/jffs/post-mount"
nvram commit


this makes it only run at reboot and does not run everytime a drive mounts.
 

sherv

New Around Here
you could skip the flash drive method and do
nvram set jffs2_exec="/jffs/post-mount"
nvram commit


this makes it only run at reboot and does not run everytime a drive mounts.

so can i just do this?
Code:
nvram set jffs2_exec="/jffs/scripts/init-start"

nvram commit

i dont have a file "post-mount" in my /jffs/ dir.... but i assume any file can be set? sorry for the idiotic questions
 

ColinTaylor

Part of the Furniture
you could skip the flash drive method and do
nvram set jffs2_exec="/jffs/post-mount"
nvram commit


this makes it only run at reboot and does not run everytime a drive mounts.
That option doesn't work any more apparently.
 

SomeWhereOverTheRainBow

Part of the Furniture
That option doesn't work any more apparently.
Yea I wasn't aware it had been removed it use to execute upon mounting of jffs I believe. I was using it to cru a scheduled reboot on an aimesh node once upon a time, but the node didn't need it once aimesh 2.0 came around.
 

toaruScar

Regular Contributor
You have 3 routers, right? Instead of running the rebooting script locally, how about running the script remotely on one of the rest two routers? You can ssh into the main router and reboot it from the side router.
 

sherv

New Around Here
Just wanted to update this thread:

  • The USB approach worked, and I got everything running for the past couple of months without issues. :cool:
    In general, the router would reboot every 4 days or thereabouts (on average), but the script would pick it up and system would be up and running with only 5mins downtime at worse:
Code:
2021-05-16 07:25:28 PM - internet connection DOWN ... REBOOT
1:06:44:29
2021-05-24 08:45:28 PM - internet connection DOWN ... REBOOT
4:05:45:54
2021-05-26 04:20:28 PM - internet connection DOWN ... REBOOT
1:19:34:28
2021-05-27 08:20:28 PM - internet connection DOWN ... REBOOT
0:08:01:26
2021-05-28 09:55:28 AM - internet connection DOWN ... REBOOT
0:13:34:27
2021-05-31 03:55:28 PM - internet connection DOWN ... REBOOT
1:23:21:52
2021-06-05 09:20:28 AM - internet connection DOWN ... REBOOT
4:17:24:25
2021-06-08 07:10:28 PM - internet connection DOWN ... REBOOT
3:09:49:25
2021-06-18 08:10:28 AM - internet connection DOWN ... REBOOT
2:21:19:18
2021-06-23 04:15:28 PM - internet connection DOWN ... REBOOT
5:08:04:25
2021-06-27 05:55:28 PM - internet connection DOWN ... REBOOT
4:01:39:27
2021-07-02 07:55:28 AM - internet connection DOWN ... REBOOT
4:13:59:25
2021-07-16 10:00:28 PM - internet connection DOWN ... REBOOT
4:08:17:03
The number in the bottom of the date/time is the "uptime" of the router prior to reboot.

  • Asus apparently updated the firmware several times during that period, and since it was still happening I just kept updating it automatically. However, this last update has been running great, because for the first time the system has not rebooted in over 2 weeks!!! Could a miracle have happened and Asus actually fixed this issue???:oops:


here is the firmware running on both right now:
 

Latest threads

Sign Up For SNBForums Daily Digest

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