]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blob - debian/spamass-milter.init
98647d9cfafb2bdff0788f406a6c1f2b0ae4413a
[deb_pkgs/spamass-milter.git] / debian / spamass-milter.init
1 #!/bin/sh
2 #
3 # $Id$
4 #
5 # Sample init script for Debian GNU/Linux
6 #
7 #  Copyright (c) 2002 Georg C. F. Greve <greve@gnu.org>,
8 #   all rights maintained by FSF Europe e.V., 
9 #   Villa Vogelsang, Antonienallee 1, 45279 Essen, Germany
10 #
11 #   This program is free software; you can redistribute it and/or modify
12 #   it under the terms of the GNU General Public License as published by
13 #   the Free Software Foundation; either version 2 of the License, or
14 #   (at your option) any later version.
15 #  
16 #   This program is distributed in the hope that it will be useful,
17 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
18 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 #   GNU General Public License for more details.
20 #  
21 #   You should have received a copy of the GNU General Public License
22 #   along with this program; if not, write to the Free Software
23 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 #
25 #   Contact:
26 #            Michael Brown <michaelb@opentext.com>
27
28 # This init script was modified on Thu, 30 Jan 2003 02:06:04 -0500 by
29 # Don Armstrong <don@donarmstrong.com> from contrib/spamass-milter to
30 # allow force-reload and options specified in
31 # /etc/default/spamass-milter necessary for inclusion in debian.
32
33
34 PATH=/sbin:/bin:/usr/sbin:/usr/bin
35 DAEMON=/usr/sbin/spamass-milter
36 SOCKET=/var/run/sendmail/spamass.sock
37 PIDFILE=/var/run/spamass.pid
38 DESC="Sendmail milter plugin for SpamAssassin"
39
40 DEFAULT=/etc/default/spamass-milter
41 OPTIONS=""
42
43 test -x $DAEMON || exit 0
44
45 if [ -r $DEFAULT ]; then
46     . $DEFAULT;
47 fi;
48
49 set -e
50
51 case "$1" in
52   start)
53         echo -n "Starting $DESC: "
54
55         if [ ! -d $(basename $SOCKET) ]; then
56             mkdir -p $(basename $SOCKET);
57         fi;
58         start-stop-daemon --start -p $PIDFILE --exec $DAEMON -- -P $PIDFILE -f -p $SOCKET $OPTIONS
59
60         echo "${DAEMON}"
61         ;;
62   stop)
63         echo -n "Stopping $DESC: "
64
65         start-stop-daemon --stop -p $PIDFILE --signal 3 --exec $DAEMON
66         /bin/sleep 5s
67         /bin/rm -f $SOCKET
68
69         echo "${DAEMON}"
70         ;;
71   force-reload | restart)
72         echo -n "Restarting $DESC: "
73
74         start-stop-daemon --stop -p $PIDFILE --signal 3 --exec $DAEMON
75         /bin/sleep 5s
76         /bin/rm -f $SOCKET
77         start-stop-daemon --start -p $PIDFILE --exec $DAEMON -- -P $PIDFILE -f -p $SOCKET $OPTIONS
78
79         echo "${DAEMON}"
80
81         ;;
82   *)
83         N=$0
84         echo "Usage: $N {start|stop|restart}" >&2
85         exit 1
86         ;;
87 esac
88
89 exit 0