/etc/init.d/spamass-milter is in spamass-milter 0.4.0-1+b1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | #!/bin/sh
#
# $Id$
#
# Sample init script for Debian GNU/Linux
#
# Copyright (c) 2002 Georg C. F. Greve <greve@gnu.org>,
# all rights maintained by FSF Europe e.V.,
# Villa Vogelsang, Antonienallee 1, 45279 Essen, Germany
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Contact:
# Michael Brown <michaelb@opentext.com>
# This init script was modified on Thu, 30 Jan 2003 02:06:04 -0500 by
# Don Armstrong <don@donarmstrong.com> from contrib/spamass-milter to
# allow force-reload and options specified in
# /etc/default/spamass-milter necessary for inclusion in debian.
# It has been modified additionally to support LSB Boot options and
# status on Friday, July 6, 2007 14:02:44 PDT
### BEGIN INIT INFO
# Provides: spamass-milter
# Required-Start: $syslog $local_fs $remote_fs
# Required-Stop: $syslog $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: milter for spamassassin
# Description: Calls spamassassin to allow filtering out
# spam from ham in libmilter compatible MTAs.
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=spamass-milter
DAEMON=/usr/sbin/spamass-milter
SOCKET=/var/run/spamass/spamass.sock
PIDFILE=/var/run/spamass/spamass.pid
DESC="Sendmail milter plugin for SpamAssassin"
DEFAULT=/etc/default/spamass-milter
OPTIONS=""
RUNAS="spamass-milter"
CHUID=""
SOCKETMODE="0600"
SOCKETOWNER="root:root"
test -x $DAEMON || exit 0
if [ -e /etc/mail/sendmail.cf ] && egrep -q 'X.+S=local:/var/run/sendmail/spamass\.sock' /etc/mail/sendmail.cf; then
SOCKET=/var/run/sendmail/spamass.sock
SOCKETMODE=""
SOCKETOWNER=""
RUNAS=""
echo "WARNING: You are using the old location of spamass.sock. Change your input filter to use";
echo "/var/run/spamass/spamass.sock so spamass-milter can run as spamass-milter";
fi;
# If /usr/sbin/postfix exists, set up the defaults for a postfix install
# These can be overridden in /etc/default/spamass-milter
if [ -x /usr/sbin/postfix ]; then
SOCKET="/var/spool/postfix/spamass/spamass.sock"
SOCKETOWNER="postfix:postfix"
SOCKETMODE="0660"
fi;
if [ -r $DEFAULT ]; then
. $DEFAULT;
fi;
if [ -n "$RUNAS" ]; then
CHUID="--chuid $RUNAS";
fi;
set -e
start() {
# Because the default socket is in the same location as the
# pidfile, we create them in this order.
for DIR in "$(dirname $PIDFILE)" "$(dirname $SOCKET)"; do
# if the dirname is '.', then it's some kind of odd socket, like
# an inet socket. Don't create the directory in such a case
if [ "$DIR" != "." ] && [ ! -d "$DIR" ]; then
mkdir -p "$DIR";
if [ -x /sbin/restorecon ]; then
/sbin/restorecon "$DIR";
fi;
if [ -n "$RUNAS" ]; then
chown "$RUNAS" "$DIR";
fi;
fi;
done;
if [ -n "$RUNAS" ] && [ -d $(dirname $PIDFILE) ] &&
[ "$(stat -c '%U' $(dirname $PIDFILE))" != "$RUNAS" ]; then
echo "WARNING: $NAME will run as user $RUNAS but $(dirname $PIDFILE) is not owned by $RUNAS";
echo "Either delete this directory or chown it appropriately. Startup attempts may fail.";
fi;
if [ -n "$RUNAS" ] && [ $(dirname $SOCKET) != "." ] &&
[ -d $(dirname $SOCKET) ] &&
[ "$(stat -c '%U' $(dirname $SOCKET))" != "$RUNAS" ]; then
echo "WARNING: $NAME will run as user $RUNAS but $(dirname $SOCKET) is not owned by $RUNAS";
echo "Either delete this directory or chown it appropriately. Startup attempts may fail.";
fi;
if [ $(dirname $SOCKET) != "." ]; then
/bin/rm -f $SOCKET
fi;
start-stop-daemon --start -p $PIDFILE $CHUID --exec $DAEMON -- -P $PIDFILE -f -p $SOCKET $OPTIONS
sleep 1s
if [ -n "$SOCKETMODE" ]; then
chmod $SOCKETMODE $SOCKET;
fi;
if [ -n "$SOCKETOWNER" ]; then
chown $SOCKETOWNER $SOCKET;
fi;
}
stop(){
start-stop-daemon --oknodo --stop -p $PIDFILE --signal 3 --exec $DAEMON
/bin/sleep 5s
/bin/rm -f $SOCKET
/bin/rm -f $PIDFILE
}
status(){
if [ -e $PIDFILE ]; then
if kill -0 $(cat $PIDFILE); then
echo "${NAME} running";
exit 0;
else
echo "${NAME} dead but $PIDFILE exists";
exit 1;
fi;
echo "${NAME} not running";
exit 3;
fi;
}
case "$1" in
start)
echo -n "Starting $DESC: "
start
echo "${NAME}"
;;
stop)
echo -n "Stopping $DESC: "
stop
echo "${NAME}"
;;
force-reload | restart)
echo -n "Restarting $DESC: "
stop
start
echo "${NAME}"
;;
status)
status
;;
*)
N=$0
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
|