I had yesterday a litle Britney spears moment “Ups i did it again that is” xD
i was experimenting with my modem to optimize the wifi stuff, after i was finish i checked my virtual radar page and noticed i was not tracking planes at all.
so i logged in to my Rpi, well, not that was, becouse it lost his wifi connection and didnt reconnect to it.
becouse it is on the atic, and i dont have direct access to it (wont work anyway, no monitor there) i needed to pull the plug.
So i did a litle search and found the solution for it in this page
http://root42.blogspot.nl/2013/03/how-to-make-raspberry-pi-automatically.html
long story short, make a file where you want it (i have it in /etc/ named as testwifi.sh)
#!/bin/bash
TESTIP=192.168.1.1
ping -c4 ${TESTIP} > /dev/null
if $? != 0 ]
then
logger -t $0 "WiFi seems down, restarting"
ifdown --force wlan0
ifup wlan0
else
logger -t $0 "WiFi seems up."
fi
Change the IP to what you want, i simply let it ping my modem.
2nd, you need to edit crontab
*/5 * * * * root /etc/testwifi.sh
this will check the wifi link to your modem, and if present it does nothing, else it brings down the wifi, and forced it back up, and it should reconnect.
dont forget to check file rights.