debian/masqmail-debian

diff masqmail.init @ 0:5ef519035828

debian directory of masqmail-0.2.21-4
author meillo@marmaro.de
date Fri, 26 Sep 2008 21:25:48 +0200
parents
children a9bc767c6541
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/masqmail.init	Fri Sep 26 21:25:48 2008 +0200
     1.3 @@ -0,0 +1,116 @@
     1.4 +#!/bin/sh
     1.5 +### BEGIN INIT INFO
     1.6 +# Provides:          masqmail
     1.7 +# Required-Start:    $remote_fs
     1.8 +# Required-Stop:     $remote_fs
     1.9 +# Default-Start:     2 3 4 5
    1.10 +# Default-Stop:      0 1 6
    1.11 +### END INIT INFO
    1.12 +# /etc/init.d/masqmail
    1.13 +#
    1.14 +# Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
    1.15 +# Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
    1.16 +# Modified for exim by Tim Cutts <tjrc1@mole.bio.cam.ac.uk>
    1.17 +# Modified for masqmail by Gregor Hoffleit <flight@debian.org>
    1.18 +# Modified for masqmail by Oliver Kurth <oku@masqmail.cx>
    1.19 +
    1.20 +set -e
    1.21 +
    1.22 +# If you disable this file, masqmail can be run from /etc/inetd.conf
    1.23 +#exit 0
    1.24 +
    1.25 +# defaults, do not edit here but in
    1.26 +# /etc/default/masqmail
    1.27 +INIT_SMTP_DAEMON=true
    1.28 +INIT_QUEUE_DAEMON=true
    1.29 +INIT_FETCH_DAEMON=false
    1.30 +QUEUE_DAEMON_IVAL=-q10m
    1.31 +FETCH_DAEMON_IVAL=-go5m
    1.32 +
    1.33 +RUN_DIR=/var/run/masqmail
    1.34 +
    1.35 +[ -r /etc/default/masqmail ] && . /etc/default/masqmail
    1.36 +
    1.37 +PATH=/sbin:/bin:/usr/sbin:/usr/bin
    1.38 +DAEMON=/usr/sbin/masqmail
    1.39 +NAME=masqmail
    1.40 +DESC="MTA (masqmail)"
    1.41 +
    1.42 +test -x $DAEMON || exit 0
    1.43 +
    1.44 +if [ ! -f /etc/masqmail/masqmail.conf ] ; then
    1.45 +    echo "you have to configure masqmail first."
    1.46 +    exit 0
    1.47 +fi
    1.48 +
    1.49 +# Create /var/run/masqmail if /var/run/ is a tmpfs.
    1.50 +if [ ! -d $RUN_DIR ] ; then
    1.51 +    mkdir -p $RUN_DIR
    1.52 +fi
    1.53 +
    1.54 +if [ x"$INIT_SMTP_DAEMON" = x"true" ] || [ x"$INIT_QUEUE_DAEMON" = x"true" ] ; then
    1.55 +    DAEMON_ARGS=
    1.56 +    if [ x"$INIT_SMTP_DAEMON" = x"true" ] ; then
    1.57 +	DAEMON_ARGS=-bd
    1.58 +    fi
    1.59 +
    1.60 +    if [ x"$INIT_QUEUE_DAEMON" = x"true" ] ; then
    1.61 +	DAEMON_ARGS="$DAEMON_ARGS $QUEUE_DAEMON_IVAL"
    1.62 +    fi
    1.63 +    INIT_DAEMON=true
    1.64 +else
    1.65 +    INIT_DAEMON=false
    1.66 +fi
    1.67 +
    1.68 +case "$1" in
    1.69 +  start)
    1.70 +    echo -n "Starting $DESC: "
    1.71 +    if [ x"$INIT_DAEMON" = x"true" ] ; then
    1.72 +	update-inetd --disable smtp
    1.73 +	start-stop-daemon --start --startas $DAEMON \
    1.74 +	    --pidfile $RUN_DIR/masqmail.pid -- $DAEMON_ARGS
    1.75 +	echo -n " listen/queue"
    1.76 +    fi
    1.77 +    if [ x"$INIT_FETCH_DAEMON" = x"true" ] ; then
    1.78 +	start-stop-daemon --start --startas $DAEMON \
    1.79 +	    --pidfile $RUN_DIR/masqmail-get.pid -- $FETCH_DAEMON_IVAL
    1.80 +	echo -n " fetch"
    1.81 +    fi
    1.82 +    echo "."
    1.83 +    ;;
    1.84 +  stop)
    1.85 +    echo -n "Stopping $DESC: "
    1.86 +    if [ -f $RUN_DIR/masqmail.pid ] ; then
    1.87 +	start-stop-daemon --stop --oknodo --retry 1 --name $NAME --pidfile $RUN_DIR/masqmail.pid
    1.88 +	update-inetd --enable smtp
    1.89 +	echo -n " listen/queue"
    1.90 +    fi
    1.91 +    if [ -f $RUN_DIR/masqmail-get.pid ] ; then
    1.92 +	start-stop-daemon --stop --oknodo --retry 1 --name $NAME --pidfile $RUN_DIR/masqmail-get.pid
    1.93 +	echo -n " fetch"
    1.94 +    fi
    1.95 +    echo "."
    1.96 +      ;;
    1.97 +  restart)
    1.98 +    $0 stop
    1.99 +    $0 start
   1.100 +    ;;
   1.101 +  reload|force-reload)
   1.102 +    echo -n "Reloading $DESC configuration files: "
   1.103 +    if [ -f $RUN_DIR/masqmail.pid ] ; then
   1.104 +	start-stop-daemon --stop --signal 1 --pidfile $RUN_DIR/masqmail.pid
   1.105 +	echo -n " listen/queue"
   1.106 +    fi
   1.107 +    if [ -f $RUN_DIR/masqmail-get.pid ] ; then
   1.108 +	start-stop-daemon --stop --signal 1 --pidfile $RUN_DIR/masqmail-get.pid
   1.109 +	echo -n " fetch"
   1.110 +    fi
   1.111 +    echo "."
   1.112 +    ;;
   1.113 +  *)
   1.114 +    echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2
   1.115 +    exit 1
   1.116 +    ;;
   1.117 +esac
   1.118 +
   1.119 +exit 0