From a255fc4508772baf30edf443a9f5d80794e858aa Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Fri, 3 Dec 2010 16:03:18 -0500 Subject: [PATCH] Started adding the scripts to automatically run the scheduler at startup. --- install/pypo-install.py | 6 ++++++ pypo/install/liquidsoap-daemon.sh | 10 ++++++++++ pypo/install/pypo-fetch-daemon.sh | 14 ++++++++++++++ pypo/install/pypo-push-daemon.sh | 14 ++++++++++++++ pypo/scripts/ls_config.liq.dist | 8 +++----- pypo/scripts/ls_run.sh | 4 ++-- 6 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 pypo/install/liquidsoap-daemon.sh create mode 100644 pypo/install/pypo-fetch-daemon.sh create mode 100644 pypo/install/pypo-push-daemon.sh diff --git a/install/pypo-install.py b/install/pypo-install.py index 3f50436d8..aecf56de8 100644 --- a/install/pypo-install.py +++ b/install/pypo-install.py @@ -36,6 +36,7 @@ try: #os.mkdirs("/var/log/liquidsoap") #os.system("chown -R liquidsoap:liquidsoap /var/log/liquidsoap") create_path("/opt/pypo") + create_path("/opt/pypo/bin") create_path("/opt/pypo/cache") create_path("/opt/pypo/files") create_path("/opt/pypo/files/basic") @@ -44,6 +45,11 @@ try: create_path("/opt/pypo/archive") os.system("chmod -R 755 /opt/pypo/") os.system("chown -R pypo:pypo /opt/pypo") + + shutil.copy("../pypo/scripts/silence-playlist.lsp", "/opt/pypo/files/basic") + shutil.copy("../pypo/scripts/silence.mp3", "/opt/pypo/files/basic") + shutil.copy("../pypo/pypo-cli.py", "/opt/pypo/bin") + except Exception, e: print "exception:" + str(e) diff --git a/pypo/install/liquidsoap-daemon.sh b/pypo/install/liquidsoap-daemon.sh new file mode 100644 index 000000000..fa8c80ad6 --- /dev/null +++ b/pypo/install/liquidsoap-daemon.sh @@ -0,0 +1,10 @@ +#!/bin/sh +ls_user="pypo" +export HOME="/home/pypo/" +ls_path="/usr/local/bin/liquidsoap" +ls_param="/opt/pypo/bin/scripts/ls_script.liq" +echo "*** Daemontools: starting liquidsoap" +cp /opt/pypo/files/basic/silence.lsp /opt/pypo/cache/current.lsp +exec 2>&1 +exec sudo -u ${ls_user} ${ls_path} ${ls_param} +# EOF diff --git a/pypo/install/pypo-fetch-daemon.sh b/pypo/install/pypo-fetch-daemon.sh new file mode 100644 index 000000000..304304d56 --- /dev/null +++ b/pypo/install/pypo-fetch-daemon.sh @@ -0,0 +1,14 @@ +#!/bin/sh +pypo_user="pypo" +export HOME="/home/pypo/" +# Location of pypo_cli.py Python script +pypo_path="/opt/pypo/bin" +pypo_script="pypo_cli.py" +# note the -u when calling python! we need it to get unbuffered binary stdout and stderr +echo "*** Daemontools: starting daemon" +cd ${pypo_path} +exec 2>&1 +exec setuidgid ${pypo_user} \ + python -u ${pypo_path}${pypo_script} \ + -f +# EOF diff --git a/pypo/install/pypo-push-daemon.sh b/pypo/install/pypo-push-daemon.sh new file mode 100644 index 000000000..5ece47e25 --- /dev/null +++ b/pypo/install/pypo-push-daemon.sh @@ -0,0 +1,14 @@ +#!/bin/sh +pypo_user="pypo" +export HOME="/home/pypo/" +# Location of pypo_cli.py Python script +pypo_path="/opt/pypo/bin" +pypo_script="pypo_cli.py" +# note the -u when calling python! we need it to get unbuffered binary stdout and stderr +echo "*** Daemontools: starting daemon" +cd ${pypo_path} +exec 2>&1 +exec setuidgid ${pypo_user} \ + python -u ${pypo_path}${pypo_script} \ + -p +# EOF diff --git a/pypo/scripts/ls_config.liq.dist b/pypo/scripts/ls_config.liq.dist index 0dbec3f53..b71931879 100644 --- a/pypo/scripts/ls_config.liq.dist +++ b/pypo/scripts/ls_config.liq.dist @@ -2,8 +2,7 @@ # liquidsoap config file # ########################################### -# this file is specific to the obp -# installation. eg it assumes that there are +# This config assumes that there are # two instances of LS running # the "scheduler" & the "fallback" instance @@ -12,12 +11,11 @@ # general settings # ########################################### -log_file = "/var/log/obp/ls/