检查进程是否存在,不存在则启动

保存为shell脚本

count=`ps -ef | grep "frpc" | grep -v grep | wc -l`

echo $count

if [ $count -eq 0 ];then
        nohup /cagy/frpc -c frpc.ini >/dev/null 2>&1 &                      <-----启动命令
fi

chmod u+x xxx.sh

然后配置定时

crontab -e
1 * * * * /root/fr.sh
每小时1分钟执行一次

猜你喜欢

转载自blog.csdn.net/ccagy/article/details/112240292