CC-2080: Turn pypo-fetch and pypo-push into threads of the same process

Fixed install scripts to remove old instances of pypo properly
This commit is contained in:
martin 2011-03-21 10:58:30 -04:00
parent d9431f95b4
commit b922e42918
3 changed files with 18 additions and 7 deletions

View File

@ -36,14 +36,14 @@ def create_user(username):
os.system("adduser --system --quiet --group --shell /bin/bash "+username)
#set pypo password
p = os.popen('/usr/bin/passwd pypo 2>&1 1>/dev/null', 'w')
p = os.popen('/usr/bin/passwd pypo 1>/dev/null 2>&1', 'w')
p.write('pypo\n')
p.write('pypo\n')
p.close()
else:
print "User already exists."
#add pypo to audio group
os.system("adduser " + username + " audio 2>&1 1>/dev/null")
os.system("adduser " + username + " audio 1>/dev/null 2>&1")
def copy_dir(src_dir, dest_dir):
if (os.path.exists(dest_dir)) and (dest_dir != "/"):
@ -63,7 +63,7 @@ def get_current_script_dir():
try:
current_script_dir = get_current_script_dir()
print "Checking and removing any existing pypo processes"
os.system("python %s/pypo-uninstall.py 2>&1 1>/dev/null"% current_script_dir)
os.system("python %s/pypo-uninstall.py 1>/dev/null 2>&1"% current_script_dir)
time.sleep(5)
# Create users

View File

@ -10,10 +10,15 @@ if os.geteuid() != 0:
try:
print "Stopping daemontool script pypo"
os.system("svc -dx /etc/service/pypo 2>/dev/null")
os.system("svc -dx /etc/service/pypo 1>/dev/null 2>&1")
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 2>/dev/null")
os.system("svc -dx /etc/service/pypo-liquidsoap 1>/dev/null 2>&1")
os.system("killall liquidsoap")
except Exception, e:

View File

@ -15,13 +15,13 @@ def remove_path(path):
os.system("rm -rf " + path)
def remove_user(username):
os.system("killall -u %s 2>&1 1>/dev/null" % username)
os.system("killall -u %s 1>/dev/null 2>&1" % username)
#allow all process to be completely closed before we attempt to delete user
print "Waiting for processes to close..."
time.sleep(5)
os.system("deluser --remove-home " + username + " 1>/dev/null")
os.system("deluser --remove-home " + username + " 1>/dev/null 2>&1")
def get_current_script_dir():
current_script_dir = os.path.realpath(__file__)
@ -39,6 +39,12 @@ try:
print "Removing daemontool script pypo"
remove_path("rm -rf /etc/service/pypo")
if os.path.exists("/etc/service/pypo-fetch"):
remove_path("rm -rf /etc/service/pypo-fetch")
if os.path.exists("/etc/service/pypo-push"):
remove_path("rm -rf /etc/service/pypo-push")
print "Removing daemontool script pypo-liquidsoap"
remove_path("rm -rf /etc/service/pypo-liquidsoap")