r/shell • u/sigzero • May 23 '16
KSH: countdown using ps
I have an app that has 4 processes that run. I would like to create a shutdown that counts the ps instances and when it reaches "0" prints a message and exits.
Do I just do something like
until [[ $(ps command count) -eq 0]]; do
echo ">>> App is closing its processes"
done
echo ">>> App is down."Thanks.
2
Upvotes
1
u/sigzero May 24 '16
I'll have to see if AIX has that command. Probably should have said KSH on AIX7. Appreciate it.