cc-2055: switch to init.d

-fix uninstall scripts
-make daemon script for media-monitor and show-recorder
-create pid file for liquidsoap
-fix airtime-check-system
-make sure all startup scripts are using exec
This commit is contained in:
martin 2011-05-31 18:55:22 -04:00
parent 79e24e5af5
commit 079d9d36b0
14 changed files with 192 additions and 98 deletions

View file

@ -14,4 +14,5 @@ export PYTHONPATH=${api_client_path}:$PYTHONPATH
# Note the -u when calling python! we need it to get unbuffered binary stdout and stderr
exec python -u ${pypo_path}${pypo_script}
# EOF

View file

@ -4,17 +4,23 @@ USERID=pypo
GROUPID=pypo
NAME=Airtime
DAEMON=/usr/bin/airtime-playout
PIDFILE=/var/run/airtime.pid
DAEMON0=/usr/bin/airtime-playout
PIDFILE0=/var/run/airtime-playout.pid
DAEMON1=/usr/bin/airtime-liquidsoap
PIDFILE1=/var/run/airtime-liquidsoap.pid
start () {
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE0 --startas $DAEMON0
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE1 --startas $DAEMON1
}
stop () {
# Send TERM after 5 seconds, wait at most 30 seconds.
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
rm -f $PIDFILE
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE0
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1
rm -f $PIDFILE0
rm -f $PIDFILE1
}

View file

@ -89,9 +89,11 @@ try:
sys.exit()
current_script_dir = get_current_script_dir()
print "Checking and removing any existing pypo processes"
os.system("python %s/pypo-uninstall.py 1>/dev/null 2>&1"% current_script_dir)
time.sleep(5)
#print "Checking and removing any existing pypo processes"
#os.system("python %s/pypo-uninstall.py 1>/dev/null 2>&1"% current_script_dir)
#time.sleep(5)
p = Popen("/etc/init.d/airtime-playout stop", shell=True)
sts = os.waitpid(p.pid, 0)[1]
# Create users
create_user("pypo")

View file

@ -37,30 +37,17 @@ try:
print 'Error loading config file: ', e
sys.exit()
os.system("python /usr/bin/airtime-playout-stop")
os.system("/etc/init.d/airtime-playout stop")
print "Removing cache directories"
remove_path(config["cache_base_dir"])
print "Removing symlinks"
os.system("rm -f /usr/bin/airtime-playout-start")
os.system("rm -f /usr/bin/airtime-playout-stop")
os.system("rm -f /usr/bin/airtime-playout")
print "Removing pypo files"
remove_path(config["bin_dir"])
print "Removing daemontool script pypo"
remove_path("/etc/service/pypo")
if os.path.exists("/etc/service/pypo-fetch"):
remove_path("/etc/service/pypo-fetch")
if os.path.exists("/etc/service/pypo-push"):
remove_path("/etc/service/pypo-push")
print "Removing daemontool script pypo-liquidsoap"
remove_path("/etc/service/pypo-liquidsoap")
remove_user("pypo")
print "Pypo uninstall complete."
except Exception, e: