debian/masqmail-debian
annotate masqmail.init @ 62:4ed3577e5044
Added tag 0.2.27-1 for changeset afae1a8e900f
author | meillo@marmaro.de |
---|---|
date | Mon, 19 Jul 2010 23:22:09 +0200 |
parents | a9bc767c6541 |
children |
rev | line source |
---|---|
meillo@0 | 1 #!/bin/sh |
meillo@0 | 2 ### BEGIN INIT INFO |
meillo@0 | 3 # Provides: masqmail |
meillo@0 | 4 # Required-Start: $remote_fs |
meillo@0 | 5 # Required-Stop: $remote_fs |
meillo@0 | 6 # Default-Start: 2 3 4 5 |
meillo@0 | 7 # Default-Stop: 0 1 6 |
meillo@10 | 8 # Short-Description: Starts and stops the masqmail daemon |
meillo@10 | 9 # Description: The masqmail daemon listens on for incoming SMTP |
meillo@10 | 10 # connections and processes its mail queue in regular |
meillo@10 | 11 # intervals. Regular fetching of mail is possible too. |
meillo@0 | 12 ### END INIT INFO |
meillo@0 | 13 # /etc/init.d/masqmail |
meillo@0 | 14 # |
meillo@0 | 15 # Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>. |
meillo@0 | 16 # Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>. |
meillo@0 | 17 # Modified for exim by Tim Cutts <tjrc1@mole.bio.cam.ac.uk> |
meillo@0 | 18 # Modified for masqmail by Gregor Hoffleit <flight@debian.org> |
meillo@0 | 19 # Modified for masqmail by Oliver Kurth <oku@masqmail.cx> |
meillo@0 | 20 |
meillo@56 | 21 # standards version 3.9.0 recommends to be careful with `set -e' in |
meillo@56 | 22 # init scripts. See 9.3.2 of the policy for reference. |
meillo@56 | 23 # TODO: We should investigate into this. |
meillo@0 | 24 set -e |
meillo@0 | 25 |
meillo@0 | 26 # If you disable this file, masqmail can be run from /etc/inetd.conf |
meillo@0 | 27 #exit 0 |
meillo@0 | 28 |
meillo@0 | 29 # defaults, do not edit here but in |
meillo@0 | 30 # /etc/default/masqmail |
meillo@0 | 31 INIT_SMTP_DAEMON=true |
meillo@0 | 32 INIT_QUEUE_DAEMON=true |
meillo@0 | 33 INIT_FETCH_DAEMON=false |
meillo@0 | 34 QUEUE_DAEMON_IVAL=-q10m |
meillo@0 | 35 FETCH_DAEMON_IVAL=-go5m |
meillo@0 | 36 |
meillo@0 | 37 RUN_DIR=/var/run/masqmail |
meillo@0 | 38 |
meillo@0 | 39 [ -r /etc/default/masqmail ] && . /etc/default/masqmail |
meillo@0 | 40 |
meillo@0 | 41 PATH=/sbin:/bin:/usr/sbin:/usr/bin |
meillo@0 | 42 DAEMON=/usr/sbin/masqmail |
meillo@0 | 43 NAME=masqmail |
meillo@0 | 44 DESC="MTA (masqmail)" |
meillo@0 | 45 |
meillo@0 | 46 test -x $DAEMON || exit 0 |
meillo@0 | 47 |
meillo@0 | 48 if [ ! -f /etc/masqmail/masqmail.conf ] ; then |
meillo@0 | 49 echo "you have to configure masqmail first." |
meillo@0 | 50 exit 0 |
meillo@0 | 51 fi |
meillo@0 | 52 |
meillo@0 | 53 # Create /var/run/masqmail if /var/run/ is a tmpfs. |
meillo@0 | 54 if [ ! -d $RUN_DIR ] ; then |
meillo@0 | 55 mkdir -p $RUN_DIR |
meillo@0 | 56 fi |
meillo@0 | 57 |
meillo@0 | 58 if [ x"$INIT_SMTP_DAEMON" = x"true" ] || [ x"$INIT_QUEUE_DAEMON" = x"true" ] ; then |
meillo@0 | 59 DAEMON_ARGS= |
meillo@0 | 60 if [ x"$INIT_SMTP_DAEMON" = x"true" ] ; then |
meillo@0 | 61 DAEMON_ARGS=-bd |
meillo@0 | 62 fi |
meillo@0 | 63 |
meillo@0 | 64 if [ x"$INIT_QUEUE_DAEMON" = x"true" ] ; then |
meillo@0 | 65 DAEMON_ARGS="$DAEMON_ARGS $QUEUE_DAEMON_IVAL" |
meillo@0 | 66 fi |
meillo@0 | 67 INIT_DAEMON=true |
meillo@0 | 68 else |
meillo@0 | 69 INIT_DAEMON=false |
meillo@0 | 70 fi |
meillo@0 | 71 |
meillo@0 | 72 case "$1" in |
meillo@0 | 73 start) |
meillo@0 | 74 echo -n "Starting $DESC: " |
meillo@0 | 75 if [ x"$INIT_DAEMON" = x"true" ] ; then |
meillo@0 | 76 update-inetd --disable smtp |
meillo@0 | 77 start-stop-daemon --start --startas $DAEMON \ |
meillo@0 | 78 --pidfile $RUN_DIR/masqmail.pid -- $DAEMON_ARGS |
meillo@0 | 79 echo -n " listen/queue" |
meillo@0 | 80 fi |
meillo@0 | 81 if [ x"$INIT_FETCH_DAEMON" = x"true" ] ; then |
meillo@0 | 82 start-stop-daemon --start --startas $DAEMON \ |
meillo@0 | 83 --pidfile $RUN_DIR/masqmail-get.pid -- $FETCH_DAEMON_IVAL |
meillo@0 | 84 echo -n " fetch" |
meillo@0 | 85 fi |
meillo@0 | 86 echo "." |
meillo@0 | 87 ;; |
meillo@0 | 88 stop) |
meillo@0 | 89 echo -n "Stopping $DESC: " |
meillo@0 | 90 if [ -f $RUN_DIR/masqmail.pid ] ; then |
meillo@0 | 91 start-stop-daemon --stop --oknodo --retry 1 --name $NAME --pidfile $RUN_DIR/masqmail.pid |
meillo@0 | 92 update-inetd --enable smtp |
meillo@0 | 93 echo -n " listen/queue" |
meillo@0 | 94 fi |
meillo@0 | 95 if [ -f $RUN_DIR/masqmail-get.pid ] ; then |
meillo@0 | 96 start-stop-daemon --stop --oknodo --retry 1 --name $NAME --pidfile $RUN_DIR/masqmail-get.pid |
meillo@0 | 97 echo -n " fetch" |
meillo@0 | 98 fi |
meillo@0 | 99 echo "." |
meillo@0 | 100 ;; |
meillo@0 | 101 restart) |
meillo@0 | 102 $0 stop |
meillo@0 | 103 $0 start |
meillo@0 | 104 ;; |
meillo@0 | 105 reload|force-reload) |
meillo@0 | 106 echo -n "Reloading $DESC configuration files: " |
meillo@0 | 107 if [ -f $RUN_DIR/masqmail.pid ] ; then |
meillo@0 | 108 start-stop-daemon --stop --signal 1 --pidfile $RUN_DIR/masqmail.pid |
meillo@0 | 109 echo -n " listen/queue" |
meillo@0 | 110 fi |
meillo@0 | 111 if [ -f $RUN_DIR/masqmail-get.pid ] ; then |
meillo@0 | 112 start-stop-daemon --stop --signal 1 --pidfile $RUN_DIR/masqmail-get.pid |
meillo@0 | 113 echo -n " fetch" |
meillo@0 | 114 fi |
meillo@0 | 115 echo "." |
meillo@0 | 116 ;; |
meillo@0 | 117 *) |
meillo@0 | 118 echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2 |
meillo@0 | 119 exit 1 |
meillo@0 | 120 ;; |
meillo@0 | 121 esac |
meillo@0 | 122 |
meillo@0 | 123 exit 0 |