写一个linux脚本 监控程序的运行状态 如果没有运行则启动运行, 程序已运行不做操作。
启动脚本必须 nohup sh xxx.sh &
while true
do
ps -ef | grep "程序名" | grep -v "grep"
if [ "$?" -eq 1 ]
then
nohup XXXXXX & #修改成自己的应用脚本启动命令
echo "process has been restarted!"
else
echo "process already started!"
fi
sleep 10
done