Last active
July 24, 2018 10:40
-
-
Save imsurinder90/c676f08ae1053aaf5430ea4f13d09d9a to your computer and use it in GitHub Desktop.
Revisions
-
imsurinder90 created this gist
Jul 24, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ create a new file /usr/local/bin/restart_wifi.sh and put below script in it. ping -c4 192.168.1.1 > /dev/null if [ $? != 0 ] then echo "No network connection, restarting wlan0" sudo systemctl daemon-reload sleep 5 sudo systemctl restart dhcpcd fi then Now make it executable: sudo chmod 775 /usr/local/bin/restart_wifi.sh Then add it to a crontab */5 * * * * /usr/bin/sudo -H /usr/local/bin/restart_wifi.sh >> /dev/null 2>&1 This command will check every 5 minute if wifi is stopped or not.