debian/masqmail-debian
annotate masqmail.init @ 24:ec40e54a1889
updated changelog
author | meillo@marmaro.de |
---|---|
date | Sun, 24 May 2009 20:24:32 +0200 |
parents | 5ef519035828 |
children | 8638dc3d7bcd |
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@0 | 21 set -e |
meillo@0 | 22 |
meillo@0 | 23 # If you disable this file, masqmail can be run from /etc/inetd.conf |
meillo@0 | 24 #exit 0 |
meillo@0 | 25 |
meillo@0 | 26 # defaults, do not edit here but in |
meillo@0 | 27 # /etc/default/masqmail |
meillo@0 | 28 INIT_SMTP_DAEMON=true |
meillo@0 | 29 INIT_QUEUE_DAEMON=true |
meillo@0 | 30 INIT_FETCH_DAEMON=false |
meillo@0 | 31 QUEUE_DAEMON_IVAL=-q10m |
meillo@0 | 32 FETCH_DAEMON_IVAL=-go5m |
meillo@0 | 33 |
meillo@0 | 34 RUN_DIR=/var/run/masqmail |
meillo@0 | 35 |
meillo@0 | 36 [ -r /etc/default/masqmail ] && . /etc/default/masqmail |
meillo@0 | 37 |
meillo@0 | 38 PATH=/sbin:/bin:/usr/sbin:/usr/bin |
meillo@0 | 39 DAEMON=/usr/sbin/masqmail |
meillo@0 | 40 NAME=masqmail |
meillo@0 | 41 DESC="MTA (masqmail)" |
meillo@0 | 42 |
meillo@0 | 43 test -x $DAEMON || exit 0 |
meillo@0 | 44 |
meillo@0 | 45 if [ ! -f /etc/masqmail/masqmail.conf ] ; then |
meillo@0 | 46 echo "you have to configure masqmail first." |
meillo@0 | 47 exit 0 |
meillo@0 | 48 fi |
meillo@0 | 49 |
meillo@0 | 50 # Create /var/run/masqmail if /var/run/ is a tmpfs. |
meillo@0 | 51 if [ ! -d $RUN_DIR ] ; then |
meillo@0 | 52 mkdir -p $RUN_DIR |
meillo@0 | 53 fi |
meillo@0 | 54 |
meillo@0 | 55 if [ x"$INIT_SMTP_DAEMON" = x"true" ] || [ x"$INIT_QUEUE_DAEMON" = x"true" ] ; then |
meillo@0 | 56 DAEMON_ARGS= |
meillo@0 | 57 if [ x"$INIT_SMTP_DAEMON" = x"true" ] ; then |
meillo@0 | 58 DAEMON_ARGS=-bd |
meillo@0 | 59 fi |
meillo@0 | 60 |
meillo@0 | 61 if [ x"$INIT_QUEUE_DAEMON" = x"true" ] ; then |
meillo@0 | 62 DAEMON_ARGS="$DAEMON_ARGS $QUEUE_DAEMON_IVAL" |
meillo@0 | 63 fi |
meillo@0 | 64 INIT_DAEMON=true |
meillo@0 | 65 else |
meillo@0 | 66 INIT_DAEMON=false |
meillo@0 | 67 fi |
meillo@0 | 68 |
meillo@0 | 69 case "$1" in |
meillo@0 | 70 start) |
meillo@0 | 71 echo -n "Starting $DESC: " |
meillo@0 | 72 if [ x"$INIT_DAEMON" = x"true" ] ; then |
meillo@0 | 73 update-inetd --disable smtp |
meillo@0 | 74 start-stop-daemon --start --startas $DAEMON \ |
meillo@0 | 75 --pidfile $RUN_DIR/masqmail.pid -- $DAEMON_ARGS |
meillo@0 | 76 echo -n " listen/queue" |
meillo@0 | 77 fi |
meillo@0 | 78 if [ x"$INIT_FETCH_DAEMON" = x"true" ] ; then |
meillo@0 | 79 start-stop-daemon --start --startas $DAEMON \ |
meillo@0 | 80 --pidfile $RUN_DIR/masqmail-get.pid -- $FETCH_DAEMON_IVAL |
meillo@0 | 81 echo -n " fetch" |
meillo@0 | 82 fi |
meillo@0 | 83 echo "." |
meillo@0 | 84 ;; |
meillo@0 | 85 stop) |
meillo@0 | 86 echo -n "Stopping $DESC: " |
meillo@0 | 87 if [ -f $RUN_DIR/masqmail.pid ] ; then |
meillo@0 | 88 start-stop-daemon --stop --oknodo --retry 1 --name $NAME --pidfile $RUN_DIR/masqmail.pid |
meillo@0 | 89 update-inetd --enable smtp |
meillo@0 | 90 echo -n " listen/queue" |
meillo@0 | 91 fi |
meillo@0 | 92 if [ -f $RUN_DIR/masqmail-get.pid ] ; then |
meillo@0 | 93 start-stop-daemon --stop --oknodo --retry 1 --name $NAME --pidfile $RUN_DIR/masqmail-get.pid |
meillo@0 | 94 echo -n " fetch" |
meillo@0 | 95 fi |
meillo@0 | 96 echo "." |
meillo@0 | 97 ;; |
meillo@0 | 98 restart) |
meillo@0 | 99 $0 stop |
meillo@0 | 100 $0 start |
meillo@0 | 101 ;; |
meillo@0 | 102 reload|force-reload) |
meillo@0 | 103 echo -n "Reloading $DESC configuration files: " |
meillo@0 | 104 if [ -f $RUN_DIR/masqmail.pid ] ; then |
meillo@0 | 105 start-stop-daemon --stop --signal 1 --pidfile $RUN_DIR/masqmail.pid |
meillo@0 | 106 echo -n " listen/queue" |
meillo@0 | 107 fi |
meillo@0 | 108 if [ -f $RUN_DIR/masqmail-get.pid ] ; then |
meillo@0 | 109 start-stop-daemon --stop --signal 1 --pidfile $RUN_DIR/masqmail-get.pid |
meillo@0 | 110 echo -n " fetch" |
meillo@0 | 111 fi |
meillo@0 | 112 echo "." |
meillo@0 | 113 ;; |
meillo@0 | 114 *) |
meillo@0 | 115 echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2 |
meillo@0 | 116 exit 1 |
meillo@0 | 117 ;; |
meillo@0 | 118 esac |
meillo@0 | 119 |
meillo@0 | 120 exit 0 |