Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
James 2011-09-28 13:46:10 -04:00
commit 28f1d885f2
53 changed files with 625 additions and 294 deletions

View file

@ -28,6 +28,10 @@ stop () {
rm -f $PIDFILE
}
start_no_monit() {
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
}
case "${1:-''}" in
'start')
@ -49,6 +53,12 @@ case "${1:-''}" in
start
echo "Done."
;;
'start-no-monit')
# restart commands here
echo -n "Starting $NAME: "
start_no_monit
echo "Done."
;;
'status')
# status commands here
/usr/bin/airtime-check-system

View file

@ -39,6 +39,10 @@ def get_current_script_dir():
index = current_script_dir.rindex('/')
return current_script_dir[0:index]
def copy_monit_file(current_script_dir):
shutil.copy("%s/../monit-airtime-media-monitor.cfg"%current_script_dir, "/etc/monit/conf.d/")
shutil.copy("%s/../../monit/monit-airtime-generic.cfg"%current_script_dir, "/etc/monit/conf.d/")
try:
# load config file
@ -50,6 +54,8 @@ try:
current_script_dir = get_current_script_dir()
copy_monit_file(current_script_dir)
p = Popen("/etc/init.d/airtime-media-monitor stop >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
@ -72,7 +78,7 @@ try:
sts = os.waitpid(p.pid, 0)[1]
print "Waiting for processes to start..."
p = Popen("/etc/init.d/airtime-media-monitor start", shell=True)
p = Popen("/etc/init.d/airtime-media-monitor start-no-monit", shell=True)
sts = os.waitpid(p.pid, 0)[1]
except Exception, e:

View file

@ -18,6 +18,9 @@ def get_current_script_dir():
index = current_script_dir.rindex('/')
return current_script_dir[0:index]
def remove_monit_file():
os.system("rm -f /etc/monit/conf.d/monit-airtime-media-monitor.cfg")
try:
# load config file
try:
@ -30,6 +33,9 @@ try:
os.system("rm -f /etc/init.d/airtime-media-monitor")
os.system("update-rc.d -f airtime-media-monitor remove >/dev/null 2>&1")
print "Removing monit file"
remove_monit_file()
print "Removing log directories"
remove_path(config["log_dir"])

View 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-media-monitor
with pidfile "/var/run/airtime-media-monitor.pid"
start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-media-monitor stop"

View file

@ -1,31 +0,0 @@
set daemon 10 # Poll at 5 second intervals
#set logfile syslog facility log_daemon
set logfile /var/log/monit.log
set httpd port 2812
allow admin:monit
check process airtime-playout
with pidfile "/var/run/airtime-playout.pid"
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds
stop program = "/etc/init.d/airtime-playout stop"
check process airtime-liquidsoap
with pidfile "/var/run/airtime-liquidsoap.pid"
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds
stop program = "/etc/init.d/airtime-playout stop"
check process airtime-media-monitor
with pidfile "/var/run/airtime-media-monitor.pid"
start program = "/etc/init.d/airtime-media-monitor start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-media-monitor stop"
check process airtime-show-recorder
with pidfile "/var/run/airtime-show-recorder.pid"
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-show-recorder stop"
check process icecast2
matching "/usr/bin/icecast2"
start program = "/etc/init.d/icecast2 start" with timeout 10 seconds
stop program = "/etc/init.d/icecast2 stop"
check process rabbitmq-server
with pidfile "/var/run/rabbitmq.pid"
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid'"
stop program = "/etc/init.d/rabbitmq-server stop"

View file

@ -0,0 +1,10 @@
set daemon 10 # Poll at 5 second intervals
set logfile /var/log/monit.log
set httpd port 2812
allow admin:monit
check process rabbitmq-server
with pidfile "/var/run/rabbitmq.pid"
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid'"
stop program = "/etc/init.d/rabbitmq-server stop"

View file

@ -0,0 +1,11 @@
set daemon 10 # Poll at 5 second intervals
#set logfile syslog facility log_daemon
set logfile /var/log/monit.log
set httpd port 2812
allow admin:monit
check process rabbitmq-server
with pidfile "/var/run/rabbitmq.pid"
start program = "/bin/bash -c '/etc/init.d/rabbitmq-server start; sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids > /var/run/rabbitmq.pid'"
stop program = "/etc/init.d/rabbitmq-server stop"

View file

@ -66,6 +66,11 @@ monit_restart() {
}
start_no_monit() {
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE0 --startas $DAEMON0
liquidsoap_start
}
case "${1:-''}" in
'start')
# start commands here
@ -86,6 +91,12 @@ case "${1:-''}" in
start
echo "Done."
;;
'start-no-monit')
# restart commands here
echo -n "Starting $NAME: "
start_no_monit
echo "Done."
;;
'monit-restart')
# restart commands here
echo -n "Monit Restarting $NAME: "

View file

@ -50,6 +50,10 @@ def is_natty():
return True
return False
def copy_monit_file(current_script_dir):
shutil.copy("%s/../monit-airtime-playout.cfg"%current_script_dir, "/etc/monit/conf.d/")
shutil.copy("%s/../monit-airtime-liquidsoap.cfg"%current_script_dir, "/etc/monit/conf.d/")
shutil.copy("%s/../../monit/monit-airtime-generic.cfg"%current_script_dir, "/etc/monit/conf.d/")
try:
# load config file
@ -61,6 +65,8 @@ try:
current_script_dir = get_current_script_dir()
copy_monit_file(current_script_dir)
p = Popen("/etc/init.d/airtime-playout stop >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
@ -147,7 +153,7 @@ try:
else:
print "Unable to connect to the Airtime server."
print "Waiting for processes to start..."
p = Popen("/etc/init.d/airtime-playout start", shell=True)
p = Popen("/etc/init.d/airtime-playout start-no-monit", shell=True)
sts = os.waitpid(p.pid, 0)[1]

View file

@ -17,6 +17,10 @@ def get_current_script_dir():
current_script_dir = os.path.realpath(__file__)
index = current_script_dir.rindex('/')
return current_script_dir[0:index]
def remove_monit_file():
os.system("rm -f /etc/monit/conf.d/monit-airtime-playout.cfg")
os.system("rm -f /etc/monit/conf.d/monit-airtime-liquidsoap.cfg")
try:
# load config file
@ -30,8 +34,11 @@ try:
os.system("rm -f /etc/init.d/airtime-playout")
os.system("update-rc.d -f airtime-playout remove >/dev/null 2>&1")
#copy logrotate script
#remove logrotate script
os.system("rm -f /etc/logrotate.d/airtime-liquidsoap")
print "Removing monit file"
remove_monit_file()
print "Removing cache directories"
remove_path(config["cache_base_dir"])

View 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-liquidsoap
with pidfile "/var/run/airtime-liquidsoap.pid"
start program = "/etc/init.d/airtime-playout monit-restart" with timeout 5 seconds
stop program = "/etc/init.d/airtime-playout stop"

View 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 monit-restart" with timeout 5 seconds
stop program = "/etc/init.d/airtime-playout stop"

View file

@ -29,6 +29,10 @@ stop () {
rm -f $PIDFILE
}
start_no_monit() {
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE --startas $DAEMON
}
case "${1:-''}" in
'start')
@ -50,6 +54,12 @@ case "${1:-''}" in
start
echo "Done."
;;
'start-no-monit')
# restart commands here
echo -n "Starting $NAME: "
start_no_monit
echo "Done."
;;
'status')
# status commands here
/usr/bin/airtime-check-system

View file

@ -32,6 +32,10 @@ def get_current_script_dir():
index = current_script_dir.rindex('/')
return current_script_dir[0:index]
def copy_monit_file(current_script_dir):
shutil.copy("%s/../monit-airtime-show-recorder.cfg"%current_script_dir, "/etc/monit/conf.d/")
shutil.copy("%s/../../monit/monit-airtime-generic.cfg"%current_script_dir, "/etc/monit/conf.d/")
try:
# load config file
@ -43,6 +47,8 @@ try:
current_script_dir = get_current_script_dir()
copy_monit_file(current_script_dir)
p = Popen("/etc/init.d/airtime-show-recorder stop >/dev/null 2>&1", shell=True)
sts = os.waitpid(p.pid, 0)[1]
@ -69,7 +75,7 @@ try:
sts = os.waitpid(p.pid, 0)[1]
print "Waiting for processes to start..."
p = Popen("/etc/init.d/airtime-show-recorder start", shell=True)
p = Popen("/etc/init.d/airtime-show-recorder start-no-monit", shell=True)
sts = os.waitpid(p.pid, 0)[1]
except Exception, e:

View file

@ -17,6 +17,10 @@ def get_current_script_dir():
current_script_dir = os.path.realpath(__file__)
index = current_script_dir.rindex('/')
return current_script_dir[0:index]
def remove_monit_file():
os.system("rm -f /etc/monit/conf.d/monit-airtime-show-recorder.cfg")
try:
# load config file
@ -29,6 +33,9 @@ try:
os.system("/etc/init.d/airtime-show-recorder stop")
os.system("rm -f /etc/init.d/airtime-show-recorder")
os.system("update-rc.d -f airtime-show-recorder remove >/dev/null 2>&1")
print "Removing monit file"
remove_monit_file()
print "Removing log directories"
remove_path(config["log_dir"])

View 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-show-recorder
with pidfile "/var/run/airtime-show-recorder.pid"
start program = "/etc/init.d/airtime-show-recorder start" with timeout 10 seconds
stop program = "/etc/init.d/airtime-show-recorder stop"