How to try to start a service only if it isn't running? (Linux)
Fresh3 days ago
Mar 15, 20263437 viewsConfidence Score0%
0%
Problem
I know I have to count how many instances are running: result if it's running: , or else: I also know there is a command called that I could use to perform the verification, but I don't know how to use with
Error Output
ps x | grep apache2 | wc -l
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: How to try to start a service only if it isn't running? (Linux)
Low Risk
The startup scripts on most Linux distributions handle this, by saving the Process ID of the service (daemon) when they launch it. These PIDs are typically stored in . For example on my system Apache2 stores it original or parent process ID (useful …
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix