105 lines
2.1 KiB
Bash
Executable file
105 lines
2.1 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# munin-cgi-html Start and stop Munin FastCGI processes for NGINX
|
|
#
|
|
# chkconfig: - 80 20
|
|
# description: Spawn Munin FastCGI scripts to be used by NGINX web server
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides:
|
|
# Required-Start: $network $syslog
|
|
# Required-Stop:
|
|
# Should-Start:
|
|
# Should-Stop:
|
|
# Default-Start:
|
|
# Default-Stop: 0 1 2 6
|
|
# Short-Description: Start and stop Munin FastCGI processes
|
|
# Description: Spawn Munin FastCGI scripts to be used by NGINX web server
|
|
### END INIT INFO
|
|
|
|
# Source function library.
|
|
. /etc/rc.d/init.d/functions
|
|
|
|
exec=/usr/bin/spawn-fcgi
|
|
lockfile=/var/lock/subsys/munin-cgi-html
|
|
|
|
htmlprog=/var/www/html/munin/cgi/munin-cgi-html
|
|
htmlsock=/var/run/munin/munin-cgi-html.sock
|
|
htmlpid=/var/run/munin/munin-cgi-html.pid
|
|
|
|
HTMLOPTIONS="-u munin -U nginx -S -M 0600 -F 1"
|
|
[ -f /etc/sysconfig/munin-cgi-html ] && . /etc/sysconfig/munin-cgi-html
|
|
|
|
munin_cleanup() {
|
|
# Remove the socket if it exists
|
|
[ -n "${htmlsock}" -a -S "${htmlsock}" ] && rm -f ${htmlsock}
|
|
}
|
|
|
|
start() {
|
|
munin_cleanup
|
|
echo -n $"Starting munin-cgi-html: "
|
|
daemon "${exec} -s ${htmlsock} -P ${htmlpid} ${HTMLOPTIONS} -- ${htmlprog} >/dev/null"
|
|
RETVAL=$?
|
|
echo
|
|
if [ $RETVAL -eq 0 ]; then
|
|
touch $lockfile
|
|
fi
|
|
return $RETVAL
|
|
}
|
|
|
|
stop() {
|
|
echo -n $"Stopping munin-cgi-html: "
|
|
killproc $htmlprog
|
|
RETVAL=$?
|
|
echo
|
|
munin_cleanup
|
|
[ $RETVAL -eq 0 ] && rm -f $lockfile
|
|
return $RETVAL
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
reload() {
|
|
restart
|
|
}
|
|
|
|
rh_status() {
|
|
# run checks to determine if the service is running or use generic status
|
|
status $htmlprog
|
|
}
|
|
|
|
rh_status_q() {
|
|
rh_status &>/dev/null
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
rh_status_q && exit 0
|
|
$1
|
|
;;
|
|
stop)
|
|
rh_status_q || exit 0
|
|
$1
|
|
;;
|
|
restart)
|
|
$1
|
|
;;
|
|
reload)
|
|
rh_status_q || exit 7
|
|
$1
|
|
;;
|
|
status)
|
|
rh_status
|
|
;;
|
|
condrestart|try-restart)
|
|
rh_status_q || exit 0
|
|
restart
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload}"
|
|
exit 2
|
|
esac
|
|
exit $?
|