summaryrefslogtreecommitdiff
path: root/debian/init
blob: 7cc4f7ccf2bdcde6c0fd7f8a59260104dbf10c56 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh

### BEGIN INIT INFO
# Provides:          mailgraph
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Mail statistics frontend for Postfix
### END INIT INFO

MAILGRAPH_CONFIG="/etc/default/mailgraph"
NAME="mailgraph"
DAEMON="/usr/sbin/mailgraph"
PID_FILE="/var/run/mailgraph.pid"
RRD_DIR="/var/lib/mailgraph"
IGNORE_OPTION=""

if [ -f $MAILGRAPH_CONFIG ]; then
  . $MAILGRAPH_CONFIG
else
  exit 0
fi  

test -x $DAEMON || exit 0

if [ "$BOOT_START" = "false" ] ; then
  exit 0
fi

if [ "$IGNORE_LOCALHOST" = "true" ]; then
  IGNORE_OPTION="--ignore-localhost"
fi

case "$1" in
  start)
    echo -n "Starting Postfix Mail Statistics: $NAME"
    start-stop-daemon -S -q -b -p $PID_FILE -x $DAEMON -- -l $MAIL_LOG -d --daemon_rrd=$RRD_DIR $IGNORE_OPTION $EXTRA_OPTIONS
    echo "."
    ;;
  stop)
    echo -n "Stopping Postfix Mail Statistics: $NAME"
    if [ -f $PID_FILE ]; then
      kill `cat $PID_FILE`
      rm $PID_FILE
    fi
    echo "."
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  force-reload)
    $0 restart
    ;;
  *)
    echo "Usage: $0 start|stop|restart|force-reload"
    exit 1
    ;;
esac