新建ping.sh
内容:
#!/bin/sh
if ! ping -c 5 10.0.0.2 > /dev/null
then
echo `date` >>/pingtest.log
echo -e “The network is down! Now try restarting!n” >>/pingtest.log
/sbin/reboot
fi
crontab设置定期执行ping.sh即可
https://blog.csdn.net/weixin_34195364/article/details/92545198
Leave a reply