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

#!/bin/bash

WORKDIR="/usr/local/gse/gseagent"

[[ -d $WORKDIR ]] &&
{
    if ! ps aux|grep './gseAgent' | grep -v grep;then
       echo 'starting gseagent...'
       cd $WORKDIR/
       ./start.sh
       echo 
       echo 'start gseAgent success.'
    else
       echo
       echo 'gseAgent started already.'
    fi
}

echo 'start gseagent success.'

http://www.cnblogs.com/yangliheng/p/6277574.html

posted @ 2018-05-15 20:05  dion至君  阅读(361)  评论(0编辑  收藏  举报