From c1dd1e7415a232af64c52bcb3cee9e93b020de6e Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 18 Apr 2011 14:51:44 -0400 Subject: [PATCH] CC-2198: airtime-pypo-stop airtime-pypo-start are ineffective -fixed --- python_apps/pypo/airtime-pypo-stop | 34 +++++++++++++------ .../show-recorder/airtime-show-recorder-stop | 13 ++++++- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/python_apps/pypo/airtime-pypo-stop b/python_apps/pypo/airtime-pypo-stop index 388c0bc4b..4a2107279 100755 --- a/python_apps/pypo/airtime-pypo-stop +++ b/python_apps/pypo/airtime-pypo-stop @@ -3,23 +3,35 @@ import os import sys +import subprocess if os.geteuid() != 0: print "Please run this as root." sys.exit(1) try: - print "Stopping daemontool script pypo" - os.system("svc -dx /etc/service/pypo 1>/dev/null 2>&1") + print "Stopping daemontool script pypo...", + p1 = subprocess.Popen(["ps", "aux"], stdout=subprocess.PIPE) + p2 = subprocess.Popen(["awk", "/pypo-cli.py/ && !/awk/ {print $2}"], stdin=p1.stdout, stdout=subprocess.PIPE) + pypo_pid = p2.communicate()[0].strip(" \n\r\t") + if (len(pypo_pid) > 0): + os.system("svc -d /etc/service/pypo 1>/dev/null 2>&1") + os.system("svc -d /etc/service/pypo/log 1>/dev/null 2>&1") + print "Success." + else: + print "Not Running." + + print "Stopping daemontool script pypo-liquidsoap...", + p1 = subprocess.Popen(["ps", "aux"], stdout=subprocess.PIPE) + p2 = subprocess.Popen(["awk", "/ls_script.liq/ && !/awk/ {print $2}"], stdin=p1.stdout, stdout=subprocess.PIPE) + liquidsoap_pid = p2.communicate()[0].strip(" \n\r\t") + if (len(liquidsoap_pid) > 0): + os.system("svc -d /etc/service/pypo-liquidsoap 1>/dev/null 2>&1") + os.system("svc -d /etc/service/pypo-liquidsoap/log 1>/dev/null 2>&1") + os.system("kill -2 %s" % liquidsoap_pid) + print "Success." + else: + print "Not Running." - if os.path.exists("/etc/service/pypo-fetch"): - os.system("svc -dx /etc/service/pypo-fetch 1>/dev/null 2>&1") - if os.path.exists("/etc/service/pypo-push"): - os.system("svc -dx /etc/service/pypo-push 1>/dev/null 2>&1") - - print "Stopping daemontool script pypo-liquidsoap" - os.system("svc -dx /etc/service/pypo-liquidsoap 1>/dev/null 2>&1") - os.system("killall liquidsoap") - except Exception, e: print "exception:" + str(e) diff --git a/python_apps/show-recorder/airtime-show-recorder-stop b/python_apps/show-recorder/airtime-show-recorder-stop index c8eb45562..b51b1ba6a 100755 --- a/python_apps/show-recorder/airtime-show-recorder-stop +++ b/python_apps/show-recorder/airtime-show-recorder-stop @@ -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)