From 58ff9ba1a2bd7853d361908cb3d5a4a27cc3ae9e Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 19 Jan 2011 11:37:39 -0500 Subject: [PATCH 1/2] -fixed http://dev.sourcefabric.org/browse/CC-1792 --- pypo/install/pypo-daemontools-liquidsoap.sh | 3 --- pypo/install/pypo-install.py | 1 - 2 files changed, 4 deletions(-) diff --git a/pypo/install/pypo-daemontools-liquidsoap.sh b/pypo/install/pypo-daemontools-liquidsoap.sh index d7d5977dd..6f9061bfa 100644 --- a/pypo/install/pypo-daemontools-liquidsoap.sh +++ b/pypo/install/pypo-daemontools-liquidsoap.sh @@ -1,12 +1,9 @@ #!/bin/sh ls_user="pypo" export HOME="/home/pypo/" -#ls_path="/usr/local/bin/liquidsoap" ls_path="/opt/pypo/bin/liquidsoap/liquidsoap" ls_param="/opt/pypo/bin/scripts/ls_script.liq" echo "*** Daemontools: starting liquidsoap" -echo "cp /opt/pypo/files/basic/silence.lsp /opt/pypo/cache/current.lsp" -cp /opt/pypo/files/basic/silence.lsp /opt/pypo/cache/current.lsp exec 2>&1 echo "exec sudo -u ${ls_user} ${ls_path} ${ls_param} " cd /opt/pypo/bin/scripts && sudo -u ${ls_user} ${ls_path} ${ls_param} diff --git a/pypo/install/pypo-install.py b/pypo/install/pypo-install.py index bb685663c..c4391e498 100644 --- a/pypo/install/pypo-install.py +++ b/pypo/install/pypo-install.py @@ -75,7 +75,6 @@ try: print "Copying pypo files" shutil.copy("../scripts/silence.mp3", BASE_PATH+"files/basic") - shutil.copy("../scripts/silence-playlist.lsp", BASE_PATH+"files/basic") if platform.architecture()[0] == '64bit': print "Installing 64-bit liquidsoap binary" From 7a11f2aa41b84deffa1e4b5c8faf081231e121ba Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 19 Jan 2011 14:59:22 -0500 Subject: [PATCH 2/2] -streamlined the install script. Any previous running processes are shutdown immediately. --- pypo/install/pypo-install.py | 19 +++++++++++++------ pypo/install/pypo-start.py | 6 +++--- pypo/install/pypo-stop.py | 8 ++++---- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/pypo/install/pypo-install.py b/pypo/install/pypo-install.py index c4391e498..9b93f81ec 100644 --- a/pypo/install/pypo-install.py +++ b/pypo/install/pypo-install.py @@ -55,6 +55,11 @@ def copy_dir(src_dir, dest_dir): shutil.copytree(src_dir, dest_dir) try: + + print "Terminating any existing pypo processes" + os.system("python ./pypo-stop.py") + time.sleep(5) + # Create users create_user("pypo") @@ -109,7 +114,6 @@ try: os.system("chown -R pypo:pypo /etc/service/pypo-push") print "Installing daemontool script pypo-liquidsoap" - os.system("svc -dx /etc/service/pypo-liquidsoap 1>/dev/null 2>&1") create_path("/etc/service/pypo-liquidsoap") create_path("/etc/service/pypo-liquidsoap/log") shutil.copy("pypo-daemontools-liquidsoap.sh", "/etc/service/pypo-liquidsoap/run") @@ -119,15 +123,15 @@ try: print "Waiting for processes to start..." time.sleep(5) - os.system("killall liquidsoap") os.system("python ./pypo-start.py") time.sleep(2) + found = True + p = Popen('svstat /etc/service/pypo-fetch', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) output = p.stdout.read() if (output.find("unable to open supervise/ok: file does not exist") >= 0): - print "Install has completed, but daemontools is not running, please make sure you have it installed and then reboot." - sys.exit() + found = False print output p = Popen('svstat /etc/service/pypo-push', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) @@ -137,8 +141,11 @@ try: p = Popen('svstat /etc/service/pypo-liquidsoap', shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) output = p.stdout.read() print output - - print "Install complete." + + if not found: + print "Install has completed, but daemontools is not running, please make sure you have it installed and then reboot." + else: + print "Install complete." except Exception, e: print "exception:" + str(e) diff --git a/pypo/install/pypo-start.py b/pypo/install/pypo-start.py index 03c914e3f..f23794af1 100644 --- a/pypo/install/pypo-start.py +++ b/pypo/install/pypo-start.py @@ -10,13 +10,13 @@ if os.geteuid() != 0: try: print "Starting daemontool script pypo-fetch" - os.system("svc -t /etc/service/pypo-fetch") + os.system("svc -u /etc/service/pypo-fetch") print "Starting daemontool script pypo-push" - os.system("svc -t /etc/service/pypo-push") + os.system("svc -u /etc/service/pypo-push") print "Starting daemontool script pypo-liquidsoap" - os.system("svc -t /etc/service/pypo-liquidsoap") + os.system("svc -u /etc/service/pypo-liquidsoap") except Exception, e: print "exception:" + str(e) diff --git a/pypo/install/pypo-stop.py b/pypo/install/pypo-stop.py index 6e055b6b1..0f3ce5db5 100644 --- a/pypo/install/pypo-stop.py +++ b/pypo/install/pypo-stop.py @@ -10,13 +10,13 @@ if os.geteuid() != 0: try: print "Stopping daemontool script pypo-fetch" - os.system("svc -dx /etc/service/pypo-fetch") + os.system("svc -dx /etc/service/pypo-fetch 2>/dev/null") print "Stopping daemontool script pypo-push" - os.system("svc -dx /etc/service/pypo-push") + os.system("svc -dx /etc/service/pypo-push 2>/dev/null") print "Stopping daemontool script pypo-liquidsoap" - os.system("svc -dx /etc/service/pypo-liquidsoap") + os.system("svc -dx /etc/service/pypo-liquidsoap 2>/dev/null") except Exception, e: - print "exception:" + str(e) \ No newline at end of file + print "exception:" + str(e)