wget 实现web监控脚本

#!/bin/sbin
timeout=3
times=3
url=https://1.1.1.1

while true;do
    wget --no-check-certificate --timeout=$timeout --tries=$times $url -q -O /dev/null
    [ $? -eq 0 ] && echo success || echo "system is down"
    sleep 2
done

 

bash -x aa.sh   // -x 可以跟踪详细的执行过程,有利于脚本的调试。

posted @ 2017-03-14 13:59  Vincen_shen  阅读(442)  评论(0编辑  收藏  举报