Skip to content

nrailuj/Wifi-Check

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wifi-Check

Checks if there is a Wifi connection and restarts the NetworkManager if necessary.

I was having problems with the wifi connection on one of my PIs. Every time it lost the connection I had to reboot it manually.

To avoid the manual reboot I wrote this little service which automatically restarts the NetworkManager if it is not connected to the router.

Description

This script pings the router to check if the WiFi connection is active. If the connection is lost, it restarts the NetworkManager to re-establish the connection.

Installation

Copy the file check-wifi.sh to /usr/local/bin/check-wifi.sh.

Change the ROUTER_Ip="888.888.888.888" to the IP address of your router.

And make the script executable with chmod +x /usr/local/bin/check-wifi.sh

Now create the Systemd service in /etc/systemd/system/wifi-check.service

And also the Systemd timer in /etc/systemd/system/wifi-check.timer

Then reload the daemon with systemctl daemon-reload

And enable and start the timer with systemctl enable wifi-check.timer && systemctl start wifi-check.timer

View the Logs

With journalctl -t wifi-check you can view the connection check logs..

With journalctl -t wifi-check -f you can see the live logss.

About

Checks if there is a Wifi connection and restarts the NetworkManager if necessary.

Resources

License

Stars

Watchers

Forks

Contributors

Languages