summaryrefslogtreecommitdiff
path: root/mailgraph-init
blob: 22b835766230e7c7390cb3f2d147358b80bbd207 (plain)
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
#!/bin/sh

# $Id: mailgraph-init 19 2005-06-13 11:23:22Z dws $
# example init script for mailgraph
#
# chkconfig: 2345 82 28
# description: mailgraph postfix log grapher.
#
# processname: mailgraph.pl
# pidfile: /var/run/mailgraph.pid


PATH=/bin:/usr/bin
MAILGRAPH_PL=/usr/local/bin/mailgraph.pl
MAIL_LOG=/var/log/syslog
PID_FILE=/var/run/mailgraph.pid
RRD_DIR=/var/lib

case "$1" in
'start')
	echo "Starting mail statistics grapher: mailgraph";
	nice -19 $MAILGRAPH_PL -l $MAIL_LOG -d \
		--daemon-pid=$PID_FILE --daemon-rrd=$RRD_DIR
	;;

'stop')
	echo "Stopping mail statistics grapher: mailgraph";
	if [ -f $PID_FILE ]; then
		kill `cat $PID_FILE`
		rm $PID_FILE
	else
		echo "mailgraph not running";
	fi
	;;

*)
	echo "Usage: $0 { start | stop }"
	exit 1
	;;

esac
exit 0