I have the command:
ps ax | grep my_application
Which outputs a large string including the port of the proccesses involved in my_application.
If my_application is not running it outputs:
3873 pts/0 S+ 0:00 grep my_application
I need a condition to test the output of ps ax | grep my_application and do exit 2in case my_application is still running.
Any ideas?
pgrepif you have it.ps ax | grep my_applicationcommand produces two or more lines as output then it means that the process is currently running or otherwise it's not.