Stop wifi go into ad hoc mode:
Code:
nano /etc/rc.local
#wifi-live-or-reset
Schedule check internet connection and run command at no connection and restart python script automatically when internet is recover:
http://forum.arduino.cc/index.php?topic=222867.msg1621158#msg1621158
Code:
...
if [ $count -eq 0 ]; then
# no internet do clean job, kill bridge and your script
/sbin/wifi
/etc/init.d/network restart
else
...