BSD/Linux DrupalRecover Tech

RaspberryPi wifi restart

(2016 update) I actually wondered where this one went!

I’ve got a Raspberry Pi that keeps losing its wifi connection whenever the microwave runs too long. Here’s at least one way to get around this since the wifi doesn’t seem to rescan on its own.

Firstly – create a script that will check for an internet connection and restart the interface if the connection is down:


ping -c4 ${TESTIP} > /dev/null

if [ $? != 0 ]


    logger -t $0 "WiFi seems down, restarting"

    echo "WiFi seems down, restarting"

    sudo /sbin/ifdown --force wlan0

    sudo /sbin/ifup wlan0


    logger -t $0 "WiFi seems up."

    echo "WiFi seems up."


Then create a crontab entry that runs the script every 15 minutes (or whatever). Voila! This seems to work well so far.

Leave a Reply

Your email address will not be published. Required fields are marked *