replace many Popen calls with more modern subprocess.call
This commit is contained in:
parent
ece93ac054
commit
8de8a0be33
4 changed files with 13 additions and 22 deletions
|
@ -1,6 +1,7 @@
|
|||
import platform
|
||||
import shutil
|
||||
from subprocess import Popen, PIPE
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
sys.path.append('/usr/lib/airtime/')
|
||||
|
@ -115,17 +116,14 @@ try:
|
|||
print "Unable to connect to the Airtime server."
|
||||
|
||||
#initialize init.d scripts
|
||||
p = Popen("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
subprocess.call("update-rc.d airtime-playout defaults >/dev/null 2>&1", shell=True)
|
||||
|
||||
#clear out an previous pypo cache
|
||||
print "* Clearing previous pypo cache"
|
||||
p = Popen("rm -rf '/var/tmp/airtime/pypo/cache/scheduler/*' >/dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
|
||||
subprocess.call("rm -rf '/var/tmp/airtime/pypo/cache/scheduler/*' >/dev/null 2>&1", shell=True)
|
||||
|
||||
print "* Waiting for pypo processes to start..."
|
||||
p = Popen("invoke-rc.d airtime-playout start-no-monit > /dev/null 2>&1", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
subprocess.call("invoke-rc.d airtime-playout start-no-monit > /dev/null 2>&1", shell=True)
|
||||
|
||||
except Exception, e:
|
||||
print e
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from subprocess import Popen
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if os.geteuid() != 0:
|
||||
print "Please run this as root."
|
||||
|
@ -10,8 +10,7 @@ try:
|
|||
#stop pypo and liquidsoap processes
|
||||
print "Waiting for pypo processes to stop...",
|
||||
if (os.path.exists('/etc/init.d/airtime-playout')):
|
||||
p = Popen("invoke-rc.d airtime-playout stop", shell=True)
|
||||
sts = os.waitpid(p.pid, 0)[1]
|
||||
subprocess.call("invoke-rc.d airtime-playout stop", shell=True)
|
||||
print "OK"
|
||||
else:
|
||||
print "Wasn't running"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue