开发者

check if script is running 10 times, if not restart

Hey, i have some problems with bash..

want to check if the ROBSTER process is running R开发者_开发知识库UNNING times if not start until;

#!/bin/sh
SERVICE='ROBSTER'
RUNNING=20

var=$(ps aux | grep $SERVICE|grep -v SCREEN|wc -l)
echo $var

if [ $var -gt $RUNNING ]
then
for  i in $(seq $var RUNNING)
do
echo "start" 
done
fi

but it wont work :-/ :D hope you could help me


ps aux | grep ROBSTER|grep -v SCREEN

after u have changed the question:

var=$(ps aux | grep ROBSTER|grep -v SCREEN|wc -l)

echo $var 
if [ var -gt 10 ]
then 
    do run your process the number of times you need
fi
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜