Created
March 18, 2015 16:14
-
-
Save chetan/206428059e4ec83effbd to your computer and use it in GitHub Desktop.
Script to fix WIFI issues on the Raspberry Pi B+
This file contains 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 characters
#!/bin/bash | |
# The raspberrypi would occasionally lose WIFI. | |
# The fix is to reset the interface manually or reboot the device. | |
# | |
# Script should be run as root and run every 5 min: | |
# crontab: | |
# */5 * * * * /root/bin/fix_wifi.sh | |
PATH="/sbin:$PATH" | |
ifconfig wlan0 | grep -q "inet addr:" | |
ret=$? | |
if [ $ret -ne 0 ] ; then | |
logger 'WIFI connection down! Attempting reconnection.' | |
ifdown --force wlan0 | |
sleep 10 | |
ifup --force wlan0 | |
sleep 10 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment