cc-2055: switch to init.d
-monit is now temporarily disabled when intentionally stopped a service
This commit is contained in:
parent
ec6db96025
commit
2f5a1c4df6
|
@ -97,6 +97,8 @@ if ($overwrite) {
|
||||||
echo "* Creating INI files".PHP_EOL;
|
echo "* Creating INI files".PHP_EOL;
|
||||||
AirtimeIni::CreateIniFiles();
|
AirtimeIni::CreateIniFiles();
|
||||||
}
|
}
|
||||||
|
AirtimeIni::CreateMonitFile();
|
||||||
|
|
||||||
|
|
||||||
AirtimeInstall::InstallPhpCode();
|
AirtimeInstall::InstallPhpCode();
|
||||||
AirtimeInstall::InstallBinaries();
|
AirtimeInstall::InstallBinaries();
|
||||||
|
|
|
@ -27,6 +27,7 @@ class AirtimeIni
|
||||||
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
|
const CONF_FILE_RECORDER = "/etc/airtime/recorder.cfg";
|
||||||
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
const CONF_FILE_LIQUIDSOAP = "/etc/airtime/liquidsoap.cfg";
|
||||||
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
|
const CONF_FILE_MEDIAMONITOR = "/etc/airtime/media-monitor.cfg";
|
||||||
|
const CONF_FILE_MONIT = "/etc/monit/conf.d/airtime-monit.cfg";
|
||||||
|
|
||||||
public static function IniFilesExist()
|
public static function IniFilesExist()
|
||||||
{
|
{
|
||||||
|
@ -75,7 +76,14 @@ class AirtimeIni
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (!copy(__DIR__."/../../python_apps/media-monitor/media-monitor.cfg", AirtimeIni::CONF_FILE_MEDIAMONITOR)){
|
if (!copy(__DIR__."/../../python_apps/media-monitor/media-monitor.cfg", AirtimeIni::CONF_FILE_MEDIAMONITOR)){
|
||||||
echo "Could not copy MediaMonitor.cfg to /etc/airtime/. Exiting.";
|
echo "Could not copy media-monitor.cfg to /etc/airtime/. Exiting.";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function CreateMonitFile(){
|
||||||
|
if (!copy(__DIR__."/../../python_apps/monit/airtime-monit.cfg", AirtimeIni::CONF_FILE_MONIT)){
|
||||||
|
echo "Could not copy airtime-monit.cfg to /etc/monit/conf.d/. Exiting.";
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,14 @@ NAME=Airtime\ Media\ Monitor
|
||||||
DAEMON=/usr/lib/airtime/media-monitor/airtime-media-monitor
|
DAEMON=/usr/lib/airtime/media-monitor/airtime-media-monitor
|
||||||
PIDFILE=/var/run/airtime-media-monitor.pid
|
PIDFILE=/var/run/airtime-media-monitor.pid
|
||||||
|
|
||||||
start () {
|
start () {
|
||||||
|
monit monitor airtime-media-monitor
|
||||||
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 $PIDFILE --startas $DAEMON
|
||||||
}
|
}
|
||||||
|
|
||||||
stop () {
|
stop () {
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||||
|
monit unmonitor airtime-media-monitor
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
set daemon 10 # Poll at 10 second intervals
|
set daemon 10 # Poll at 10 second intervals
|
||||||
set logfile syslog facility log_daemon
|
set logfile syslog facility log_daemon
|
||||||
|
|
||||||
|
set httpd port 2812 and use address 127.0.0.1
|
||||||
|
allow localhost
|
||||||
|
allow admin:monit
|
||||||
|
|
||||||
check process airtime-playout
|
check process airtime-playout
|
||||||
with pidfile "/var/run/airtime-playout.pid"
|
with pidfile "/var/run/airtime-playout.pid"
|
||||||
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
|
start program = "/etc/init.d/airtime-playout start" with timeout 10 seconds
|
||||||
|
|
|
@ -19,15 +19,22 @@ PIDFILE0=/var/run/airtime-playout.pid
|
||||||
DAEMON1=/usr/lib/airtime/pypo/bin/airtime-liquidsoap
|
DAEMON1=/usr/lib/airtime/pypo/bin/airtime-liquidsoap
|
||||||
PIDFILE1=/var/run/airtime-liquidsoap.pid
|
PIDFILE1=/var/run/airtime-liquidsoap.pid
|
||||||
|
|
||||||
start () {
|
start () {
|
||||||
|
monit monitor airtime-playout
|
||||||
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 $PIDFILE0 --startas $DAEMON0
|
||||||
|
|
||||||
|
monit monitor airtime-liquidsoap
|
||||||
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE1 --startas $DAEMON1
|
start-stop-daemon --start --background --quiet --chuid $USERID:$GROUPID --make-pidfile --pidfile $PIDFILE1 --startas $DAEMON1
|
||||||
}
|
}
|
||||||
|
|
||||||
stop () {
|
stop () {
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||||
|
|
||||||
|
monit unmonitor airtime-playout
|
||||||
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 $PIDFILE0
|
||||||
rm -f $PIDFILE0
|
rm -f $PIDFILE0
|
||||||
|
|
||||||
|
monit unmonitor airtime-liquidsoap
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1
|
||||||
rm -f $PIDFILE1
|
rm -f $PIDFILE1
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,15 @@ NAME=Airtime\ Show\ Recorder
|
||||||
DAEMON=/usr/lib/airtime/show-recorder/airtime-show-recorder
|
DAEMON=/usr/lib/airtime/show-recorder/airtime-show-recorder
|
||||||
PIDFILE=/var/run/airtime-show-recorder.pid
|
PIDFILE=/var/run/airtime-show-recorder.pid
|
||||||
|
|
||||||
start () {
|
start () {
|
||||||
|
monit monitor airtime-show-recorder
|
||||||
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 $PIDFILE --startas $DAEMON
|
||||||
}
|
}
|
||||||
|
|
||||||
stop () {
|
stop () {
|
||||||
# Send TERM after 5 seconds, wait at most 30 seconds.
|
# Send TERM after 5 seconds, wait at most 30 seconds.
|
||||||
|
|
||||||
|
monit unmonitor airtime-show-recorder
|
||||||
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue