vi /root/check_internet.sh
#!/bin/shTMP_FILE=/tmp/inet_up# Edit this function if you want to do something besides rebootno_inet_action() { shutdown -r +1 'No internet.'}if ping -c5 google.com; then echo 1 > $TMP_FILEelse [[ `cat $TMP_FILE` == 0 ]] && no_inet_action || echo 0 > $TMP_FILEfi
chmod a+x /root/check_internet.sh
crontab -e
*/5 * * * * /root/check_internet.sh > /dev/null