嘿,我对bash有一些问题..
想检查 ROBSTER 进程是否正在运行 RUNNING 次,如果没有启动,直到;
#!/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
但它不会工作: - / :D希望你能帮助我
答案 0 :(得分:1)
ps aux | grep ROBSTER|grep -v SCREEN
你改变了问题之后:
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