检测进程不存在自动重启shell脚本

 1 #!/bin/bash
 2 
 3 WORKDIR="/usr/local/gse/gseagent"
 4 
 5 [[ -d $WORKDIR ]] &&
 6 {
 7     if ! ps aux|grep './gseAgent' | grep -v grep;then
 8        echo 'starting gseagent...'
 9        cd $WORKDIR/
10        ./start.sh
11        echo 
12        echo 'start gseAgent success.'
13     else
14        echo
15        echo 'gseAgent started already.'
16     fi
17 }
18 
19 echo 'start gseagent success.'

 

posted @ 2017-01-12 11:50  杨小愚  阅读(1127)  评论(0编辑  收藏  举报