debian/masqmail-debian
annotate masqmail.init @ 5:ff639a0d2e6b
added watch file
author | meillo@marmaro.de |
---|---|
date | Wed, 05 Nov 2008 11:42:17 +0100 |
parents | |
children | a9bc767c6541 |
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@0 | 8 ### END INIT INFO |
meillo@0 | 9 # /etc/init.d/masqmail |
meillo@0 | 10 # |
meillo@0 | 11 # Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>. |
meillo@0 | 12 # Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>. |
meillo@0 | 13 # Modified for exim by Tim Cutts <tjrc1@mole.bio.cam.ac.uk> |
meillo@0 | 14 # Modified for masqmail by Gregor Hoffleit <flight@debian.org> |
meillo@0 | 15 # Modified for masqmail by Oliver Kurth <oku@masqmail.cx> |
meillo@0 | 16 |
meillo@0 | 17 set -e |
meillo@0 | 18 |
meillo@0 | 19 # If you disable this file, masqmail can be run from /etc/inetd.conf |
meillo@0 | 20 #exit 0 |
meillo@0 | 21 |
meillo@0 | 22 # defaults, do not edit here but in |
meillo@0 | 23 # /etc/default/masqmail |
meillo@0 | 24 INIT_SMTP_DAEMON=true |
meillo@0 | 25 INIT_QUEUE_DAEMON=true |
meillo@0 | 26 INIT_FETCH_DAEMON=false |
meillo@0 | 27 QUEUE_DAEMON_IVAL=-q10m |
meillo@0 | 28 FETCH_DAEMON_IVAL=-go5m |
meillo@0 | 29 |
meillo@0 | 30 RUN_DIR=/var/run/masqmail |
meillo@0 | 31 |
meillo@0 | 32 [ -r /etc/default/masqmail ] && . /etc/default/masqmail |
meillo@0 | 33 |
meillo@0 | 34 PATH=/sbin:/bin:/usr/sbin:/usr/bin |
meillo@0 | 35 DAEMON=/usr/sbin/masqmail |
meillo@0 | 36 NAME=masqmail |
meillo@0 | 37 DESC="MTA (masqmail)" |
meillo@0 | 38 |
meillo@0 | 39 test -x $DAEMON || exit 0 |
meillo@0 | 40 |
meillo@0 | 41 if [ ! -f /etc/masqmail/masqmail.conf ] ; then |
meillo@0 | 42 echo "you have to configure masqmail first." |
meillo@0 | 43 exit 0 |
meillo@0 | 44 fi |
meillo@0 | 45 |
meillo@0 | 46 # Create /var/run/masqmail if /var/run/ is a tmpfs. |
meillo@0 | 47 if [ ! -d $RUN_DIR ] ; then |
meillo@0 | 48 mkdir -p $RUN_DIR |
meillo@0 | 49 fi |
meillo@0 | 50 |
meillo@0 | 51 if [ x"$INIT_SMTP_DAEMON" = x"true" ] || [ x"$INIT_QUEUE_DAEMON" = x"true" ] ; then |
meillo@0 | 52 DAEMON_ARGS= |
meillo@0 | 53 if [ x"$INIT_SMTP_DAEMON" = x"true" ] ; then |
meillo@0 | 54 DAEMON_ARGS=-bd |
meillo@0 | 55 fi |
meillo@0 | 56 |
meillo@0 | 57 if [ x"$INIT_QUEUE_DAEMON" = x"true" ] ; then |
meillo@0 | 58 DAEMON_ARGS="$DAEMON_ARGS $QUEUE_DAEMON_IVAL" |
meillo@0 | 59 fi |
meillo@0 | 60 INIT_DAEMON=true |
meillo@0 | 61 else |
meillo@0 | 62 INIT_DAEMON=false |
meillo@0 | 63 fi |
meillo@0 | 64 |
meillo@0 | 65 case "$1" in |
meillo@0 | 66 start) |
meillo@0 | 67 echo -n "Starting $DESC: " |
meillo@0 | 68 if [ x"$INIT_DAEMON" = x"true" ] ; then |
meillo@0 | 69 update-inetd --disable smtp |
meillo@0 | 70 start-stop-daemon --start --startas $DAEMON \ |
meillo@0 | 71 --pidfile $RUN_DIR/masqmail.pid -- $DAEMON_ARGS |
meillo@0 | 72 echo -n " listen/queue" |
meillo@0 | 73 fi |
meillo@0 | 74 if [ x"$INIT_FETCH_DAEMON" = x"true" ] ; then |
meillo@0 | 75 start-stop-daemon --start --startas $DAEMON \ |
meillo@0 | 76 --pidfile $RUN_DIR/masqmail-get.pid -- $FETCH_DAEMON_IVAL |
meillo@0 | 77 echo -n " fetch" |
meillo@0 | 78 fi |
meillo@0 | 79 echo "." |
meillo@0 | 80 ;; |
meillo@0 | 81 stop) |
meillo@0 | 82 echo -n "Stopping $DESC: " |
meillo@0 | 83 if [ -f $RUN_DIR/masqmail.pid ] ; then |
meillo@0 | 84 start-stop-daemon --stop --oknodo --retry 1 --name $NAME --pidfile $RUN_DIR/masqmail.pid |
meillo@0 | 85 update-inetd --enable smtp |
meillo@0 | 86 echo -n " listen/queue" |
meillo@0 | 87 fi |
meillo@0 | 88 if [ -f $RUN_DIR/masqmail-get.pid ] ; then |
meillo@0 | 89 start-stop-daemon --stop --oknodo --retry 1 --name $NAME --pidfile $RUN_DIR/masqmail-get.pid |
meillo@0 | 90 echo -n " fetch" |
meillo@0 | 91 fi |
meillo@0 | 92 echo "." |
meillo@0 | 93 ;; |
meillo@0 | 94 restart) |
meillo@0 | 95 $0 stop |
meillo@0 | 96 $0 start |
meillo@0 | 97 ;; |
meillo@0 | 98 reload|force-reload) |
meillo@0 | 99 echo -n "Reloading $DESC configuration files: " |
meillo@0 | 100 if [ -f $RUN_DIR/masqmail.pid ] ; then |
meillo@0 | 101 start-stop-daemon --stop --signal 1 --pidfile $RUN_DIR/masqmail.pid |
meillo@0 | 102 echo -n " listen/queue" |
meillo@0 | 103 fi |
meillo@0 | 104 if [ -f $RUN_DIR/masqmail-get.pid ] ; then |
meillo@0 | 105 start-stop-daemon --stop --signal 1 --pidfile $RUN_DIR/masqmail-get.pid |
meillo@0 | 106 echo -n " fetch" |
meillo@0 | 107 fi |
meillo@0 | 108 echo "." |
meillo@0 | 109 ;; |
meillo@0 | 110 *) |
meillo@0 | 111 echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2 |
meillo@0 | 112 exit 1 |
meillo@0 | 113 ;; |
meillo@0 | 114 esac |
meillo@0 | 115 |
meillo@0 | 116 exit 0 |