-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmunin-fastcgi
More file actions
97 lines (89 loc) · 2.53 KB
/
munin-fastcgi
File metadata and controls
97 lines (89 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#! /bin/sh
### BEGIN INIT INFO
# Provides: munin-fastcgi
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts munin-fastcgi
# Description: Spawn Munin FCGI sockets for Web acces
s
### END INIT INFO
#
# munin-fastcgi Startup script for Munin CGI services
#
# chkconfig: - 84 15
# description: Loading Munin CGI services using spawn-cgi
# HTML files and CGI.
#
# Author: Ryan Norbauer <ryan.norbauer@gmail.com>
# Modified: Geoffrey Grosenbach http://topfunky.com
# Modified: David Krmpotic http://davidhq.com
# Modified: Kun Xi http://kunxi.org
# Modified: http://drumcoder.co.uk/
# Modified: http://uname.pingveno.net/
DAEMON=/usr/bin/spawn-fcgi
FCGI_GRAPH_SOCK=/var/run/munin/fastcgi-munin-graph.sock
FCGI_HTML_SOCK=/var/run/munin/fastcgi-munin-html.sock
WWW_USER=www-data
FCGI_USER=munin
FCGI_GROUP=munin
FCGI_SPAWN_GRAPH=/usr/lib/munin/cgi/munin-cgi-graph
FCGI_SPAWN_HTML=/usr/lib/munin/cgi/munin-cgi-html
PIDFILE_GRAPH=/var/run/munin/fastcgi-munin-graph.pid
PIDFILE_HTML=/var/run/munin/fastcgi-munin-html.pid
DESC="Munin FCGI for Graph an HTML"
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
test -x $FCGI_SPAWN_GRAPH || exit 0
test -x $FCGI_SPAWN_HTML || exit 0
start() {
$DAEMON -s $FCGI_GRAPH_SOCK -U $WWW_USER -u $FCGI_USER -g
$FCGI_GROUP -P $PIDFILE_GRAPH $FCGI_SPAWN_GRAPH 2> /dev/nu
ll || echo "Graph Already running"
$DAEMON -s $FCGI_HTML_SOCK -U $WWW_USER -u $FCGI_USER -g
$FCGI_GROUP -P $PIDFILE_HTML $FCGI_SPAWN_HTML 2> /dev/null
|| echo "HTML Already running"
}
stop() {
kill -QUIT `cat $PIDFILE_GRAPH` || echo "Graph not runnin
g"
kill -QUIT `cat $PIDFILE_HTML` || echo "HTML Not running"
}
restart() {
kill -HUP `cat $PIDFILE_GRAPH` || echo "Can't reload Grap
h"
kill -HUP `cat $PIDFILE_HTML` || echo "Can't reload HTML"
}
case "$1" in
start)
echo "Starting $DESC: "
start
;;
stop)
echo "Stopping $DESC: "
stop
;;
restart|reload)
echo "Restarting $DESC: "
stop
# One second might not be time enough for a daemon to s
top,
# if this happens, d_start will fail (and dpkg will bre
ak if
# the package is being upgraded). Change the timeout if
needed
# be, or change d_stop to have start-stop-daemon use --
retry.
# Notice that using --retry slows down the shutdown pro
cess somewhat.
sleep 1
start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >
&2
exit 3
;;
esac
exit $?