#!/bin/shIt will have to be registered on crontab of root:
stat=`/sbin/ifconfig wlan0 | /bin/grep -q "inet addr:"`
if [ $? -ne 0 ]
echo "Wifi restarting..."
/sbin/ifup --force wlan0
* * * * * wifi.sh
It will check the wifi every minute and reactive when the wifi is down.
You can also test it by manually deactivating it: sudo ifdown wlan0.
If it comes up by itself after one minute later, the setting is working.