Major reorganization of the pypo directory.
Much better organization of files into packages
This commit is contained in:
parent
f4d313a67c
commit
1c87d51b8e
20 changed files with 16 additions and 15 deletions
116
python_apps/pypo/install/airtime-liquidsoap-init-d
Executable file
116
python_apps/pypo/install/airtime-liquidsoap-init-d
Executable file
|
@ -0,0 +1,116 @@
|
|||
#!/bin/bash
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: airtime-liquidsoap
|
||||
# Required-Start: $local_fs $remote_fs $network $syslog
|
||||
# Required-Stop: $local_fs $remote_fs $network $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Liquidsoap daemon
|
||||
### END INIT INFO
|
||||
|
||||
USERID=pypo
|
||||
GROUPID=pypo
|
||||
NAME="Liquidsoap Playout Engine"
|
||||
|
||||
DAEMON=/usr/lib/airtime/pypo/bin/airtime-liquidsoap
|
||||
PIDFILE=/var/run/airtime-liquidsoap.pid
|
||||
EXEC='/usr/bin/airtime-liquidsoap'
|
||||
|
||||
start () {
|
||||
|
||||
mkdir -p /var/log/airtime/pypo-liquidsoap
|
||||
chown $USERID:$GROUPID /var/log/airtime/pypo-liquidsoap
|
||||
|
||||
chown $USERID:$GROUPID /etc/airtime
|
||||
touch /etc/airtime/liquidsoap.cfg
|
||||
chown $USERID:$GROUPID /etc/airtime/liquidsoap.cfg
|
||||
|
||||
touch $PIDFILE
|
||||
chown $USERID:$GROUPID $PIDFILE
|
||||
|
||||
#start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
|
||||
#--pidfile $PIDFILE --nicelevel -15 --startas $DAEMON
|
||||
start-stop-daemon --start --quiet --chuid $USERID:$GROUPID \
|
||||
--nicelevel -15 --startas $DAEMON --exec $EXEC
|
||||
}
|
||||
|
||||
stop () {
|
||||
#send term signal after 10 seconds
|
||||
timeout -s9 10s /usr/lib/airtime/airtime_virtualenv/bin/python \
|
||||
/usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
|
||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||
#start-stop-daemon --stop --oknodo --retry=TERM/10/KILL/5 --quiet --pidfile $PIDFILE
|
||||
start-stop-daemon --stop --oknodo --retry=TERM/10/KILL/5 --quiet --exec $EXEC
|
||||
|
||||
rm -f $PIDFILE
|
||||
sleep 2
|
||||
}
|
||||
|
||||
start_with_monit () {
|
||||
start
|
||||
monit monitor airtime-liquidsoap >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop_with_monit() {
|
||||
monit unmonitor airtime-liquidsoap >/dev/null 2>&1
|
||||
stop
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
case "${1:-''}" in
|
||||
'stop')
|
||||
echo "* Stopping Liquidsoap without notifying Monit process watchdog. If Monit is
|
||||
* running it will automatically bring the Liquidsoap back up. You probably want
|
||||
* 'stop-with-monit' instead of 'stop'."
|
||||
echo -n "Stopping $NAME: "
|
||||
stop
|
||||
echo "Done."
|
||||
;;
|
||||
'start')
|
||||
echo "* Starting $NAME without Monit process watchdog. To make sure Monit is watching
|
||||
* Liquidsoap, use 'start-with-monit' instead of 'start'."
|
||||
echo -n "Starting $NAME: "
|
||||
start
|
||||
echo "Done."
|
||||
;;
|
||||
'restart')
|
||||
# restart commands here
|
||||
echo -n "Restarting $NAME: "
|
||||
stop
|
||||
start
|
||||
echo "Done."
|
||||
;;
|
||||
|
||||
'status')
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
pid=`cat $PIDFILE`
|
||||
if [ -d "/proc/$pid" ]; then
|
||||
echo "$NAME is running"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo "$NAME is not running"
|
||||
exit 1
|
||||
;;
|
||||
'start-with-monit')
|
||||
# restart commands here
|
||||
echo -n "Starting $NAME: "
|
||||
start_with_monit
|
||||
echo "Done."
|
||||
;;
|
||||
'stop-with-monit')
|
||||
# restart commands here
|
||||
echo -n "Stopping $NAME: "
|
||||
stop_with_monit
|
||||
echo "Done."
|
||||
;;
|
||||
|
||||
*) # no parameter specified
|
||||
echo "Usage: $SELF start|stop|restart|status"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
83
python_apps/pypo/install/airtime-playout-init-d
Executable file
83
python_apps/pypo/install/airtime-playout-init-d
Executable file
|
@ -0,0 +1,83 @@
|
|||
#!/bin/bash
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: airtime-playout
|
||||
# Required-Start: $local_fs $remote_fs $network $syslog
|
||||
# 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=root
|
||||
NAME="Airtime Scheduler"
|
||||
|
||||
DAEMON=/usr/lib/airtime/pypo/bin/airtime-playout
|
||||
PIDFILE=/var/run/airtime-playout.pid
|
||||
|
||||
start () {
|
||||
mkdir -p /var/log/airtime/pypo
|
||||
|
||||
start-stop-daemon --start --background --quiet --chuid $USERID:$USERID \
|
||||
--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
|
||||
}
|
||||
|
||||
start_with_monit() {
|
||||
start
|
||||
monit monitor airtime-playout >/dev/null 2>&1
|
||||
}
|
||||
|
||||
stop_with_monit() {
|
||||
monit unmonitor airtime-playout >/dev/null 2>&1
|
||||
stop
|
||||
}
|
||||
|
||||
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."
|
||||
;;
|
||||
'start-with-monit')
|
||||
# restart commands here
|
||||
echo -n "Starting $NAME: "
|
||||
start_with_monit
|
||||
echo "Done."
|
||||
;;
|
||||
'stop-with-monit')
|
||||
# restart commands here
|
||||
echo -n "Stopping $NAME: "
|
||||
stop_with_monit
|
||||
echo "Done."
|
||||
;;
|
||||
|
||||
'status')
|
||||
# status commands here
|
||||
/usr/bin/airtime-check-system
|
||||
;;
|
||||
*) # no parameter specified
|
||||
echo "Usage: $SELF start|stop|restart|status"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
15
python_apps/pypo/install/monit-airtime-liquidsoap.cfg
Normal file
15
python_apps/pypo/install/monit-airtime-liquidsoap.cfg
Normal file
|
@ -0,0 +1,15 @@
|
|||
set daemon 15 # Poll at 5 second intervals
|
||||
set logfile /var/log/monit.log
|
||||
|
||||
set httpd port 2812
|
||||
|
||||
check process airtime-liquidsoap matching "airtime-liquidsoap.*airtime.*ls_script"
|
||||
start program = "/etc/init.d/airtime-liquidsoap start" with timeout 30 seconds
|
||||
stop program = "/etc/init.d/airtime-liquidsoap stop"
|
||||
|
||||
if mem > 600 MB for 3 cycles then restart
|
||||
if failed host localhost port 1234
|
||||
send "version\r\nexit\r\n"
|
||||
expect "Liquidsoap"
|
||||
with timeout 2 seconds retry 3 for 2 cycles
|
||||
then restart
|
9
python_apps/pypo/install/monit-airtime-playout.cfg
Normal file
9
python_apps/pypo/install/monit-airtime-playout.cfg
Normal file
|
@ -0,0 +1,9 @@
|
|||
set daemon 10 # Poll at 5 second intervals
|
||||
set logfile /var/log/monit.log
|
||||
|
||||
set httpd port 2812
|
||||
|
||||
check process airtime-playout
|
||||
with pidfile "/var/run/airtime-playout.pid"
|
||||
start program = "/etc/init.d/airtime-playout start" with timeout 5 seconds
|
||||
stop program = "/etc/init.d/airtime-playout stop"
|
|
@ -0,0 +1,9 @@
|
|||
set daemon 15 # Poll at 5 second intervals
|
||||
set logfile /var/log/monit.log
|
||||
|
||||
set httpd port 2812
|
||||
|
||||
check process airtime-liquidsoap
|
||||
with pidfile "/var/run/airtime-liquidsoap.pid"
|
||||
start program = "/etc/init.d/airtime-liquidsoap start" with timeout 5 seconds
|
||||
stop program = "/etc/init.d/airtime-liquidsoap stop"
|
|
@ -68,7 +68,7 @@ try:
|
|||
current_script_dir = get_current_script_dir()
|
||||
|
||||
if not os.path.exists(PATH_INI_FILE):
|
||||
shutil.copy('%s/../pypo.cfg'%current_script_dir, PATH_INI_FILE)
|
||||
shutil.copy('%s/pypo.cfg'%current_script_dir, PATH_INI_FILE)
|
||||
|
||||
try:
|
||||
os.remove("/etc/airtime/liquidsoap.cfg")
|
||||
|
@ -95,13 +95,13 @@ try:
|
|||
|
||||
monit_version = get_monit_version()
|
||||
if version_compare(monit_version, "5.3.0") >= 0:
|
||||
shutil.copy('%s/../monit-airtime-liquidsoap.cfg' % current_script_dir, \
|
||||
shutil.copy('%s/monit-airtime-liquidsoap.cfg' % current_script_dir, \
|
||||
'/etc/monit/conf.d/monit-airtime-liquidsoap.cfg')
|
||||
else:
|
||||
shutil.copy('%s/../monit-pre530-airtime-liquidsoap.cfg' % current_script_dir, \
|
||||
shutil.copy('%s/monit-pre530-airtime-liquidsoap.cfg' % current_script_dir, \
|
||||
'/etc/monit/conf.d/monit-airtime-liquidsoap.cfg')
|
||||
|
||||
shutil.copy('%s/../monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
shutil.copy('%s/monit-airtime-playout.cfg'%current_script_dir, '/etc/monit/conf.d/')
|
||||
|
||||
#create pypo log dir
|
||||
create_dir(config['pypo_log_dir'])
|
||||
|
@ -132,8 +132,8 @@ try:
|
|||
os.system("chown -R pypo:pypo "+config["base_recorded_files"])
|
||||
|
||||
#copy init.d script
|
||||
shutil.copy(config["bin_dir"]+"/bin/airtime-playout-init-d", "/etc/init.d/airtime-playout")
|
||||
shutil.copy(config["bin_dir"]+"/bin/airtime-liquidsoap-init-d", "/etc/init.d/airtime-liquidsoap")
|
||||
shutil.copy(config["bin_dir"]+"/bin/install/airtime-playout-init-d", "/etc/init.d/airtime-playout")
|
||||
shutil.copy(config["bin_dir"]+"/bin/install/airtime-liquidsoap-init-d", "/etc/init.d/airtime-liquidsoap")
|
||||
|
||||
#copy log rotate script
|
||||
shutil.copy(config["bin_dir"]+"/bin/liquidsoap_scripts/airtime-liquidsoap.logrotate", "/etc/logrotate.d/airtime-liquidsoap")
|
||||
|
|
85
python_apps/pypo/install/pypo.cfg
Normal file
85
python_apps/pypo/install/pypo.cfg
Normal file
|
@ -0,0 +1,85 @@
|
|||
############################################
|
||||
# pypo - configuration #
|
||||
############################################
|
||||
|
||||
# Set the type of client you are using.
|
||||
# Currently supported types:
|
||||
# 1) "obp" = Open Broadcast Platform
|
||||
# 2) "airtime"
|
||||
#
|
||||
api_client = "airtime"
|
||||
|
||||
############################################
|
||||
# Cache Directories #
|
||||
# *include* trailing slash !! #
|
||||
############################################
|
||||
cache_dir = '/var/tmp/airtime/pypo/cache/'
|
||||
file_dir = '/var/tmp/airtime/pypo/files/'
|
||||
tmp_dir = '/var/tmp/airtime/pypo/tmp/'
|
||||
|
||||
############################################
|
||||
# Setup Directories #
|
||||
# Do *not* include trailing slash !! #
|
||||
############################################
|
||||
cache_base_dir = '/var/tmp/airtime/pypo'
|
||||
bin_dir = '/usr/lib/airtime/pypo'
|
||||
log_base_dir = '/var/log/airtime'
|
||||
pypo_log_dir = '/var/log/airtime/pypo'
|
||||
liquidsoap_log_dir = '/var/log/airtime/pypo-liquidsoap'
|
||||
|
||||
############################################
|
||||
# Liquidsoap settings #
|
||||
############################################
|
||||
ls_host = '127.0.0.1'
|
||||
ls_port = '1234'
|
||||
|
||||
############################################
|
||||
# RabbitMQ settings #
|
||||
############################################
|
||||
rabbitmq_host = 'localhost'
|
||||
rabbitmq_user = 'guest'
|
||||
rabbitmq_password = 'guest'
|
||||
rabbitmq_vhost = '/'
|
||||
|
||||
############################################
|
||||
# pypo preferences #
|
||||
############################################
|
||||
|
||||
# Poll interval in seconds.
|
||||
#
|
||||
# This will rarely need to be changed because any schedule changes are
|
||||
# automatically sent to pypo immediately.
|
||||
#
|
||||
# This is how often the poll script downloads new schedules and files from the
|
||||
# server in the event that no changes are made to the schedule.
|
||||
#
|
||||
poll_interval = 3600 # in seconds.
|
||||
|
||||
|
||||
# Push interval in seconds.
|
||||
#
|
||||
# This is how often the push script checks whether it has something new to
|
||||
# push to liquidsoap.
|
||||
#
|
||||
# It's hard to imagine a situation where this should be more than 1 second.
|
||||
#
|
||||
push_interval = 1 # in seconds
|
||||
|
||||
# 'pre' or 'otf'. 'pre' cues while playlist preparation
|
||||
# while 'otf' (on the fly) cues while loading into ls
|
||||
# (needs the post_processor patch)
|
||||
cue_style = 'pre'
|
||||
|
||||
############################################
|
||||
# Recorded Audio settings #
|
||||
############################################
|
||||
record_bitrate = 256
|
||||
record_samplerate = 44100
|
||||
record_channels = 2
|
||||
record_sample_size = 16
|
||||
|
||||
#can be either ogg|mp3, mp3 recording requires installation of the package "lame"
|
||||
record_file_type = 'ogg'
|
||||
|
||||
# base path to store recordered shows at
|
||||
base_recorded_files = '/var/tmp/airtime/show-recorder/'
|
Loading…
Add table
Add a link
Reference in a new issue