while ps aux | grep '[/]pathtoprocess'
do
echo Running
done
echo Process Finished
我使用此shell脚本在某个进程运行时继续运行。 我现在要做的是在某个过程没有运行的同时做同样的事情。
我该怎么办? 提前致谢
答案 0 :(得分:0)
x=$(ps aux | grep '[/]pathtoprocess')
while false
do
echo Not Running
done
=============================================== ===========================
#!/bin/ksh
if ps -aux | grep "[/]$1"
then
echo "Running"
else
echo "Not Running"
#do your stuff
# you can add while loop here
#echo "process Finished
fi
./iCheck.sh xyz
Not Running
./iCheck.sh usr/bin/cron
Running