Esto parece estar publicado en toda la red sin buenas soluciones. Supongo que la mejor solución / solución es hacer que verifique la conectividad a Internet y, si no está allí, vuelva a conectarse. Hice esto a través de una prueba de ping en google.com y luego simplemente hice que reiniciara la red. El código no se prueba (la parte de reinicio y la parte de cron, si la declaración se prueba), por lo que esperaré a que se desconecte en algún momento. Tengo un Ubuntu Server 12.10, así que no tengo interfaz gráfica de usuario, y es difícil conectar el monitor y el teclado cada vez que la conexión inalámbrica se bloquea.
Cron parte hecha a través de webmin, así que Idk mucho al respecto. El guión es el siguiente:
# edited by dim_voly for networking restart on no pingback every 5 mins
#!/bin/bash
# Name of File: networkingCron
# Purpose: to check if the internet is up (via ping test to google) and if not, restart networking service
# this script is invoked via cron, ideally every 5 mins.
#check if there is internet via ping test
if ! [ "`ping -c 1 google.com`" ]; then #if ping exits nonzero...
sudo service networking restart #restart the whole thing
echo Networking service restarted due to no ping response from google.com
fi
echo Script 'networkingCron' completed, if no message above then there was no network restart.
# dunno how to restart the wifi only since that is the only active connection that server uses.
# also I don't think those echos go anywhere
Asegúrese de ejecutar como root y asegúrese de que el script tenga permisos de ejecución (u + x).
Enlaces: