shell脚本 监控进程 10秒不在就重启

#!/bin/sh

while true 

do

ps -ef|grep "test"|grep -v "grep"

if["$?"-eq 1]

then

nohup ./test &

echo "process has been restarted!"

else

echo "process already started!"

fi
sleep 10

done

你可能感兴趣的:(linux)