Automatically reconnect to the wifi network
create a file:
/usr/local/bin/wifi_rebooter.sh
with these contents:
#!/bin/bash # The IP for the server you wish to ping (8.8.8.8 is a public Google DNS server)
SERVER=8.8.8.8 # Only send two pings, sending output to /dev/null ping -c2 ${SERVER} > /dev/null # If the return code from ping ($?) is not 0 (meaning there was an error) if [ $? != 0 ] then
# Restart the wireless interface ifdown --force wlan0 ifup wlan0 fi
Make it executable:
sudo chmod +x /usr/local/bin/wifi_rebooter.sh
Schedule it by appending this line:
*/5 * * * * root /usr/local/bin/wifi_rebooter.sh
to:
/etc/crontab