masqmail

view debian/masqmail.init @ 0:08114f7dcc23

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