]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blob - debian/spamass-milter.init
* Use dirname instead of basename (closes: #391909)
[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 RUNAS=""
43 CHUID=""
44
45 test -x $DAEMON || exit 0
46
47 if [ -r $DEFAULT ]; then
48     . $DEFAULT;
49 fi;
50
51 if [ -n $RUNAS ]; then
52     CHUID="--chuid $RUNAS";
53 fi;
54
55 set -e
56
57 case "$1" in
58   start)
59         echo -n "Starting $DESC: "
60
61         if [ ! -d $(dirname $SOCKET) ]; then
62             mkdir -p $(dirname $SOCKET);
63         fi;
64         start-stop-daemon --start -p $PIDFILE $CHUID --exec $DAEMON -- -P $PIDFILE -f -p $SOCKET $OPTIONS
65
66         echo "${DAEMON}"
67         ;;
68   stop)
69         echo -n "Stopping $DESC: "
70
71         start-stop-daemon --stop -p $PIDFILE --signal 3 --exec $DAEMON
72         /bin/sleep 5s
73         /bin/rm -f $SOCKET
74
75         echo "${DAEMON}"
76         ;;
77   force-reload | restart)
78         echo -n "Restarting $DESC: "
79
80         start-stop-daemon --stop -p $PIDFILE --signal 3 --exec $DAEMON
81         /bin/sleep 5s
82         /bin/rm -f $SOCKET
83         start-stop-daemon --start -p $PIDFILE --exec $DAEMON -- -P $PIDFILE -f -p $SOCKET $OPTIONS
84
85         echo "${DAEMON}"
86
87         ;;
88   *)
89         N=$0
90         echo "Usage: $N {start|stop|restart}" >&2
91         exit 1
92         ;;
93 esac
94
95 exit 0