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