Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

checkwifi

This is a simple script that pings your local network router. If the ping fails, the script will attempt to reset wifi networking. It will then attempt another ping. If that ping also fails, the script will reboot the device.

Initial source of inspiration came from https://weworkweplay.com/play/rebooting-the-raspberry-pi-when-it-loses-wireless-connection-wifi/.

checkwifi.sh

Store this script in /usr/local/bin/checkwifi.sh

Change the IP address variable to the IP of your router or some other device on your network that you can assume will be always online.

Make sure the script has the correct permissions to run:

sudo chmod 775 /usr/local/bin/checkwifi.sh

crontab

SSH into your device and open up the crontab editor by typing crontab -e.

Add the following line:

*/5 * * * * /usr/bin/sudo -H /usr/local/bin/checkwifi.sh >> /dev/null 2>&1

This runs the script every 5 minutes as sudo (so you have permission to do the shutdown command), writing its output to /dev/null so it won't clog your syslog.

About

Simple script to check wifi, attempt to reset wifi networking or finally reboot as last resort

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages