Skip to content

Instantly share code, notes, and snippets.

@pansen
Created September 17, 2013 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pansen/6596275 to your computer and use it in GitHub Desktop.
Save pansen/6596275 to your computer and use it in GitHub Desktop.
#!/bin/bash
### BEGIN INIT INFO
# Provides: munin-fcgi
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start munin FCGI processes at boot time
# Description: Start the FCGI processes behind http://munin.*/
### END INIT INFO
graph_pidfile="/var/run/munin/fcgi_graph.pid"
# Ubuntu 12.10: /usr/lib/cgi-bin/munin-cgi-graph
graph_cgi="/usr/lib/munin/cgi/munin-cgi-graph"
html_pidfile="/var/run/munin/fcgi_html.pid"
# Ubuntu 12.10: /usr/lib/cgi-bin/munin-cgi-html
html_cgi="/usr/lib/munin/cgi/munin-cgi-html"
retval=0
. /lib/lsb/init-functions
start() {
echo -n "Starting munin graph FastCGI: "
start_daemon -p ${graph_pidfile} /usr/bin/spawn-fcgi -u munin -g munin \
-s /var/run/munin/fastcgi-graph.sock -U www-data ${graph_cgi}
echo
echo -n "Starting munin html FastCGI: "
start_daemon -p ${html_pidfile} /usr/bin/spawn-fcgi -u munin -g munin \
-s /var/run/munin/fastcgi-html.sock -U www-data ${html_cgi}
echo
retval=$?
}
stop() {
echo -n "Stopping munin graph FastCGI: "
killproc -p ${graph_pidfile} ${graph_cgi} -QUIT
echo
echo -n "Stopping munin html FastCGI: "
killproc -p ${html_pidfile} ${html_cgi} -QUIT
echo
retval=$?
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage: munin-fcgi {start|stop|restart}"
exit 1
;;
esac
exit $retval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment