Fixed everything about Airtime on Debian
* Added sysvinit scripts back in and cleaned them up * service status now works correctly for all services * Moved logging config files into install/ folders for the python_apps * Fixed some small setup.py problems in the various python_apps * Gave each python app a better bin/ script which doesn't fork, which lets service status work automagically.
This commit is contained in:
parent
bbcd4fbe2e
commit
a2d8da617d
|
@ -39,7 +39,7 @@ function checkPhpDependencies() {
|
||||||
*/
|
*/
|
||||||
function checkZendDependencies() {
|
function checkZendDependencies() {
|
||||||
return file_exists('/usr/share/php/libzend-framework-php')
|
return file_exists('/usr/share/php/libzend-framework-php')
|
||||||
|| file_exists('/usr/share/php/zendframework'); // Debian version
|
|| file_exists('/usr/share/php/Zend'); // Debian version
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -124,7 +124,7 @@ function checkRMQConnection() {
|
||||||
* @return boolean true if airtime-media-monitor is running
|
* @return boolean true if airtime-media-monitor is running
|
||||||
*/
|
*/
|
||||||
function checkMediaMonitorService() {
|
function checkMediaMonitorService() {
|
||||||
exec("pgrep -f -u www-data media_monitor", $out, $status);
|
exec("pgrep -f -u www-data airtime-media-monitor", $out, $status);
|
||||||
if (array_key_exists(0, $out) && $status == 0) {
|
if (array_key_exists(0, $out) && $status == 0) {
|
||||||
return posix_kill(rtrim($out[0]), 0);
|
return posix_kill(rtrim($out[0]), 0);
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ function checkMediaMonitorService() {
|
||||||
* @return boolean true if airtime-playout is running
|
* @return boolean true if airtime-playout is running
|
||||||
*/
|
*/
|
||||||
function checkPlayoutService() {
|
function checkPlayoutService() {
|
||||||
exec("pgrep -f -u www-data pypo", $out, $status);
|
exec("pgrep -f -u www-data airtime-playout", $out, $status);
|
||||||
if (array_key_exists(0, $out) && $status == 0) {
|
if (array_key_exists(0, $out) && $status == 0) {
|
||||||
return posix_kill(rtrim($out[0]), 0);
|
return posix_kill(rtrim($out[0]), 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ locale.setlocale(locale.LC_ALL, '')
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
global_cfg = '/etc/airtime/airtime.conf'
|
global_cfg = '/etc/airtime/airtime.conf'
|
||||||
logging_cfg = os.path.join(os.path.dirname(__file__), 'logging.cfg')
|
logging_cfg = '/etc/airtime/media_monitor_logging.cfg'
|
||||||
|
|
||||||
mm2.main( global_cfg, logging_cfg )
|
mm2.main( global_cfg, logging_cfg )
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,9 @@ else:
|
||||||
mm2_files.append(os.path.join(root, filename))
|
mm2_files.append(os.path.join(root, filename))
|
||||||
|
|
||||||
data_files = [
|
data_files = [
|
||||||
('/etc/init', ['install/airtime-media-monitor.conf.template']),
|
('/etc/init', ['install/upstart/airtime-media-monitor.conf.template']),
|
||||||
|
('/etc/init.d', ['install/sysvinit/airtime-media-monitor']),
|
||||||
|
('/etc/airtime', ['install/media_monitor_logging.cfg']),
|
||||||
('/var/log/airtime/media-monitor', []),
|
('/var/log/airtime/media-monitor', []),
|
||||||
('/var/tmp/airtime/media-monitor', []),
|
('/var/tmp/airtime/media-monitor', []),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
#!/bin/bash -e
|
#!/usr/bin/python
|
||||||
|
import runpy
|
||||||
|
|
||||||
exec python -m liquidsoap 2>&1
|
# Run the liquidsoap python module
|
||||||
|
runpy.run_module('liquidsoap')
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/python
|
||||||
|
import runpy
|
||||||
|
|
||||||
|
runpy.run_module("pypo", run_name="__main__")
|
||||||
|
|
||||||
exec python -m pypo > /var/log/airtime/pypo/py-interpreter.log 2>&1
|
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: airtime-liquidsoap
|
||||||
|
# Required-Start: $local_fs $remote_fs $network $syslog $all
|
||||||
|
# Required-Stop: $local_fs $remote_fs $network $syslog
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Manage airtime-liquidsoap daemon
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
USERID=www-data
|
||||||
|
GROUPID=www-data
|
||||||
|
NAME=airtime-liquidsoap
|
||||||
|
|
||||||
|
DAEMON=/usr/bin/$NAME
|
||||||
|
PIDFILE=/var/run/$NAME.pid
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
|
# Read configuration variable file if it is present
|
||||||
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
|
||||||
|
# Load the VERBOSE setting and other rcS variables
|
||||||
|
. /lib/init/vars.sh
|
||||||
|
|
||||||
|
# Define LSB log_* functions.
|
||||||
|
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
|
||||||
|
# and status_of_proc is working.
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
start () {
|
||||||
|
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
|
||||||
|
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
case "${1:-''}" in
|
||||||
|
'start')
|
||||||
|
# start commands here
|
||||||
|
echo -n "Starting $NAME: "
|
||||||
|
start
|
||||||
|
echo "Done."
|
||||||
|
;;
|
||||||
|
'stop')
|
||||||
|
# stop commands here
|
||||||
|
echo -n "Stopping $NAME: "
|
||||||
|
stop
|
||||||
|
echo "Done."
|
||||||
|
;;
|
||||||
|
'restart')
|
||||||
|
# restart commands here
|
||||||
|
echo -n "Restarting $NAME: "
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
echo "Done."
|
||||||
|
;;
|
||||||
|
'status')
|
||||||
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
|
;;
|
||||||
|
*) # no parameter specified
|
||||||
|
echo "Usage: $SELF start|stop|restart|status"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
|
@ -0,0 +1,71 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: airtime-playout
|
||||||
|
# Required-Start: $local_fs $remote_fs $network $syslog $all
|
||||||
|
# Required-Stop: $local_fs $remote_fs $network $syslog
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Manage airtime-playout daemon
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
USERID=www-data
|
||||||
|
GROUPID=www-data
|
||||||
|
NAME=airtime-playout
|
||||||
|
|
||||||
|
DAEMON=/usr/bin/$NAME
|
||||||
|
PIDFILE=/var/run/$NAME.pid
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
|
# Read configuration variable file if it is present
|
||||||
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
|
||||||
|
# Load the VERBOSE setting and other rcS variables
|
||||||
|
. /lib/init/vars.sh
|
||||||
|
|
||||||
|
# Define LSB log_* functions.
|
||||||
|
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
|
||||||
|
# and status_of_proc is working.
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
start () {
|
||||||
|
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID \
|
||||||
|
--make-pidfile --pidfile $PIDFILE --startas $DAEMON
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
case "${1:-''}" in
|
||||||
|
'start')
|
||||||
|
# start commands here
|
||||||
|
echo -n "Starting $NAME: "
|
||||||
|
start
|
||||||
|
echo "Done."
|
||||||
|
;;
|
||||||
|
'stop')
|
||||||
|
# stop commands here
|
||||||
|
echo -n "Stopping $NAME: "
|
||||||
|
stop
|
||||||
|
echo "Done."
|
||||||
|
;;
|
||||||
|
'restart')
|
||||||
|
# restart commands here
|
||||||
|
echo -n "Restarting $NAME: "
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
echo "Done."
|
||||||
|
;;
|
||||||
|
'status')
|
||||||
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
|
;;
|
||||||
|
*) # no parameter specified
|
||||||
|
echo "Usage: $SELF start|stop|restart|status"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
|
@ -39,10 +39,11 @@ def run():
|
||||||
generate_liquidsoap_config(ss)
|
generate_liquidsoap_config(ss)
|
||||||
successful = True
|
successful = True
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
print "Unable to connect to the Airtime server."
|
||||||
|
logging.error(str(e))
|
||||||
|
logging.error("traceback: %s", traceback.format_exc())
|
||||||
if attempts == max_attempts:
|
if attempts == max_attempts:
|
||||||
print "Unable to connect to the Airtime server."
|
logging.error("giving up and exiting...")
|
||||||
logging.error(str(e))
|
|
||||||
logging.error("traceback: %s", traceback.format_exc())
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
|
@ -18,9 +18,12 @@ else:
|
||||||
pypo_files.append(os.path.join(root, filename))
|
pypo_files.append(os.path.join(root, filename))
|
||||||
|
|
||||||
data_files = [
|
data_files = [
|
||||||
('/etc/init', ['install/airtime-playout.conf.template']),
|
('/etc/init', ['install/upstart/airtime-playout.conf.template']),
|
||||||
('/etc/init', ['install/airtime-liquidsoap.conf.template']),
|
('/etc/init', ['install/upstart/airtime-liquidsoap.conf.template']),
|
||||||
('/etc/airtime', ['pypo/notify_logging.cfg']),
|
('/etc/init.d', ['install/sysvinit/airtime-playout']),
|
||||||
|
('/etc/init.d', ['install/sysvinit/airtime-liquidsoap']),
|
||||||
|
('/etc/airtime', ['install/notify_logging.cfg']),
|
||||||
|
('/etc/airtime', ['install/pypo_logging.cfg']),
|
||||||
('/var/log/airtime/pypo', []),
|
('/var/log/airtime/pypo', []),
|
||||||
('/var/log/airtime/pypo-liquidsoap', []),
|
('/var/log/airtime/pypo-liquidsoap', []),
|
||||||
('/var/tmp/airtime/pypo', []),
|
('/var/tmp/airtime/pypo', []),
|
||||||
|
@ -36,7 +39,7 @@ setup(name='airtime-playout',
|
||||||
url='http://github.com/sourcefabric/Airtime',
|
url='http://github.com/sourcefabric/Airtime',
|
||||||
author='sourcefabric',
|
author='sourcefabric',
|
||||||
license='AGPLv3',
|
license='AGPLv3',
|
||||||
packages=['pypo', 'pypo.media.update',
|
packages=['pypo', 'pypo.media', 'pypo.media.update',
|
||||||
'liquidsoap', 'liquidsoap.library'],
|
'liquidsoap', 'liquidsoap.library'],
|
||||||
package_data={'': ['*.liq', '*.cfg']},
|
package_data={'': ['*.liq', '*.cfg']},
|
||||||
scripts=[
|
scripts=[
|
||||||
|
|
Loading…
Reference in New Issue