继续潜水

导航

 

2行为项目名称

12行为应用启动命令

 1 #!/bin/bash
 2 name= dmserver
 3 echo ------------------------
 4 echo "ps -ef | grep dmserver | grep -v "grep" | wc -l"
 5 while true
 6 do
 7     count=`ps -ef | grep dmserver | grep -v "grep" | wc -l`
 8     echo $count
 9     if [ $count == 0 ];then
10     echo "监听:$name," $(date +"%Y-%m-%d %H:%M:%S") "服务不存在" 
11     echo 执行命令 service dmserver start
12     `service dmserver start`
13     else
14     echo "监听:$name," $(date +"%Y-%m-%d %H:%M:%S") "服务存在" 
15     fi
16     sleep 3
17 done

posted on 2022-11-01 16:37  继续潜水  阅读(71)  评论(0编辑  收藏  举报