shell监控进程脚本

  

#!/bin/env sh

while [ true ];do
        count=$(ps -ef|grep $1|grep -v grep|grep -v $1)
        if [[ -z $count ]];then
                echo failed
                sh $1
        else
                echo success
        fi
        sleep 2
done
~

 

posted @ 2020-10-10 20:48  ascertain  阅读(298)  评论(0编辑  收藏  举报