Hi,
I am willing to build a script that does a "ps-ef" or "top" on a specific process, and if it finds it running to start another process.
Any suggestions to do this in a optimized way?
Thanks!
Hi,
I am willing to build a script that does a "ps-ef" or "top" on a specific process, and if it finds it running to start another process.
Any suggestions to do this in a optimized way?
Thanks!
Well, if you do
ps -ef | grep specific-process | wc -l
will give you a count. And, it will be one because of the ps command, or two if the specific-process is running.
So, store to a variable and then check if the variable is equal to two. If so, then do whatever else you want to do.
What about pgrep -c ?