- create a file check_network.sh
#!/bin/bash
x=`ping -c1 google.com 2>&1 | grep unknown`
if [ ! "$x" = "" ]; then
echo "It's down!! Attempting to restart."
/etc/init.d/networking restart
echo "restarted gurke" | mail -s gurke_restart test@hotmail.com
fi
- chmod 777 check_network.sh
- add it to crontab so it checks it for every hour or so..