debian/masqmail-debian

view masqmail.init @ 10:a9bc767c6541

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