使用shell脚本监测web网站

SHELL

i=`netstat -lntup|grep nginx|wc -l`
panduan(){
    if [ "$1" != "web" ]
    then
        echo  "please in (web) "
        exit 1
    else
        echo
    fi
}
jyt(){
    if [ $i -eq 0 ]
    then
        echo "nginx down web is down"
    else
        echo "nginx is ok web is ok"
    fi
}
case "$1" in
    web)
        jyt
        ;;
    *)
        panduan
esac
posted @ 2019-06-08 20:44  小疯紫  阅读(299)  评论(0编辑  收藏  举报