|
|
|
@ -68,21 +68,26 @@ def _get_service_status(name, pattern):
|
|
|
|
|
# If pattern is provided, search for that
|
|
|
|
|
# before checking initctl, service output, and other tricks
|
|
|
|
|
if pattern is not None:
|
|
|
|
|
|
|
|
|
|
psbin = '/bin/ps'
|
|
|
|
|
if not os.path.exists(psbin):
|
|
|
|
|
if os.path.exists('/usr/bin/ps'):
|
|
|
|
|
psbin = '/usr/bin/ps'
|
|
|
|
|
else:
|
|
|
|
|
psbin = None
|
|
|
|
|
|
|
|
|
|
if psbin is not None:
|
|
|
|
|
(rc, psout, pserr) = _run('%s %s' % (psbin, PS_OPTIONS))
|
|
|
|
|
# If rc is 0, set running as appropriate
|
|
|
|
|
# If ps command fails, fall back to other means.
|
|
|
|
|
if rc == 0:
|
|
|
|
|
if pattern in psout:
|
|
|
|
|
running = True
|
|
|
|
|
else:
|
|
|
|
|
running = False
|
|
|
|
|
running = False
|
|
|
|
|
lines = psout.split("\n")
|
|
|
|
|
for line in lines:
|
|
|
|
|
if pattern in line and not "pattern=" in line:
|
|
|
|
|
# so as to not confuse ./hacking/test-module
|
|
|
|
|
running = True
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
# Check if we got upstart on the system and then the job state
|
|
|
|
|
if INITCTL != None and running is None:
|
|
|
|
|