#!/bin/sh
while true
do
ps -ef | grep "test" | grep -v "grep"
if [ "$?" -eq 1 ]
then
#需要启动的脚本
./test.sh
echo "process has been restarted!"
else
echo "process already started!"
fi
#检查时间间隔10s
sleep 10
done
#!/bin/sh
while true
do
ps -ef | grep "test" | grep -v "grep"
if [ "$?" -eq 1 ]
then
#需要启动的脚本
./test.sh
echo "process has been restarted!"
else
echo "process already started!"
fi
#检查时间间隔10s
sleep 10
done
本文标题:linux自启动脚本
本文链接:https://www.haomeiwen.com/subject/abzqlctx.html
网友评论