linux shell 监控进程是否运行

180it 2021-06-20 PM 1313℃ 0条
#!/bin/sh
#Project3 为进程名
# 提示错误请用该命令处理下文件空格 sed -i 's/\r$//' ./run.sh
ps -fe|grep Project3 |grep -v grep
if [ $? -ne 0 ]
then
echo "Project3进程不存在"
#不存在则运行
nohup /cmd/Project3 jc1.4936.cn 10 >>/cmd/jc1run.log 2>&1 &
nohup /cmd/Project3 jc2.4936.cn 11 >>/cmd/jc2run.log 2>&1 &
nohup /cmd/Project3 jc3.4936.cn 12 >>/cmd/jc3run.log 2>&1 &
nohup /cmd/Project3 jc4.4936.cn 13 >>/cmd/jc4run.log 2>&1 &
nohup /cmd/Project3 jc5.4936.cn 14 >>/cmd/jc5run.log 2>&1 &
nohup /cmd/Project3 jc6.4936.cn 15 >>/cmd/jc6run.log 2>&1 &
nohup /cmd/Project3 jc7.4936.cn 16 >>/cmd/jc7run.log 2>&1 &
nohup /cmd/Project3 jc8.4936.cn 16 >>/cmd/jc8run.log 2>&1 &

else
echo "Project3进程存在"
fi
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

linux shell 监控进程是否运行