How to try to start a service only if it isn't running? (Linux)

Posted by Jader Dias on Super User See other posts from Super User or by Jader Dias
Published on 2010-04-16T13:26:06Z Indexed on 2010/04/16 13:33 UTC
Read the original article Hit count: 203

Filed under:
|
|
|
|

I know I have to count how many instances are running:

ps x | grep apache2 | wc -l 

result if it's running: 2, or else: 1

I also know there is a command called test that I could use to perform the verification, but I don't know how to use test with wc

© Super User or respective owner

Related posts about test

Related posts about wc