CC-2198: airtime-pypo-stop airtime-pypo-start are ineffective
-fixed
This commit is contained in:
parent
fab68dfad1
commit
c1dd1e7415
2 changed files with 35 additions and 12 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
|
@ -10,7 +11,17 @@ if os.geteuid() != 0:
|
|||
|
||||
try:
|
||||
print "Stopping daemontool script recorder"
|
||||
os.system("svc -dx /etc/service/recorder 1>/dev/null 2>&1")
|
||||
|
||||
p1 = subprocess.Popen(["ps", "aux"], stdout=subprocess.PIPE)
|
||||
p2 = subprocess.Popen(["awk", "/recorder.py/ && !/awk/ {print $2}"], stdin=p1.stdout, stdout=subprocess.PIPE)
|
||||
recorder_pid = p2.communicate()[0].strip(" \n\r\t")
|
||||
if (len(recorder_pid) > 0):
|
||||
os.system("svc -d /etc/service/recorder 1>/dev/null 2>&1")
|
||||
os.system("svc -d /etc/service/recorder/log 1>/dev/null 2>&1")
|
||||
os.system("kill -2 %s" % recorder_pid)
|
||||
print "Success."
|
||||
else:
|
||||
print "Not Running."
|
||||
|
||||
except Exception, e:
|
||||
print "exception:" + str(e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue