diff options
Diffstat (limited to 'debian/init')
-rw-r--r-- | debian/init | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/debian/init b/debian/init new file mode 100644 index 0000000..cd5bdff --- /dev/null +++ b/debian/init @@ -0,0 +1,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 + 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 |