Check network bash
1 2 3 4 5 6 7 |
#!/bin/bash timestamp=$(date +%Y/%m/%d_%T%Z) ping -c5 www.ustc.edu.cn if [ $? -ne 0 ]; then echo "[${timestamp}] Can't Connect to internate, reboot now..." >> /var/log/checknet.log /sbin/reboot fi |
我们必须不断奔跑,才能不至于沉沦下去!
1 2 3 4 5 6 7 |
#!/bin/bash timestamp=$(date +%Y/%m/%d_%T%Z) ping -c5 www.ustc.edu.cn if [ $? -ne 0 ]; then echo "[${timestamp}] Can't Connect to internate, reboot now..." >> /var/log/checknet.log /sbin/reboot fi |