Skip to content

Shell script to check every 15 minutes for internet connection on ai mesh node. If failed, it waits 4 minutes, checks again and then will reboot upon 2nd fail

Notifications You must be signed in to change notification settings

joshuajones02/ASUS.AiMesh.NodeReboot.ScheduledJob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Start

SSH into ASUS router and execute the following

cd /jffs
mkdir scripts
cd scripts
touch pingcheck.sh
touch services-start
chmod a+x /jffs/scripts/pingcheck.sh
chmod a+x /jffs/scripts/services-start

Enable jffs2 executing the following commands

nvram set jffs2_on=1
nvram set jffs2_enable=1
#nvram set jffs2_format=1 
nvram set jffs2_scripts=1
nvram commit
reboot

After reboot, open pingcheck.sh

vi pingcheck.sh

Paste in content

#!/bin/sh
if ! ping -w 10 -c 10 1.1.1.1 > /dev/null; then
sleep 240
#wait 4 minutes in case of another router in reboot cycle.
if ! ping -w 10 -c 10 1.1.1.1 > /dev/null; then
reboot
fi
fi

Open services-start and copy in contents of its file

#!/bin/sh
cru a NoPingReboot "*/15 * * * * /jffs/scripts/pingcheck.sh"

Commit services-start to nvram to run cron upon reboot

nvram set jffs2_exec="/jffs/scripts/services-start"
nvram commit

To verify, reboot again and check cron

cru l

Or add the scheduled cron job manually

cru a NoPingReboot "*/15 * * * * /jffs/scripts/pingcheck.sh"

Verify job added

cru l

About

Shell script to check every 15 minutes for internet connection on ai mesh node. If failed, it waits 4 minutes, checks again and then will reboot upon 2nd fail

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages