#!/bin/sh
#
# $Id: spamass-milter,v 1.4 2002/07/24 16:19:53 dnelson Exp $
#
# 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>
#

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/etc/mail/bin/spamass-milter
SOCKET=/var/run/sendmail/spamass.sock
DESC="Sendmail milter plugin for SpamAssassin"

test -x $DAEMON || exit 0

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "

	start-stop-daemon --start -b --exec $DAEMON --oknodo -- -p $SOCKET

	echo "${DAEMON}"
	;;
  stop)
	echo -n "Stopping $DESC: "

	start-stop-daemon --stop --exec $DAEMON --oknodo 
	/bin/sleep 5s
	/bin/rm -f $SOCKET

	echo "${DAEMON}"
	;;
  restart)
	echo -n "Restarting $DESC: "

	start-stop-daemon --stop --exec $DAEMON --oknod
	/bin/sleep 5s
	/bin/rm -f $SOCKET
        start-stop-daemon --start -b --exec $DAEMON --oknodo -- -p $SOCKET

        echo "${DAEMON}"

	;;
  *)
	N=$0
	echo "Usage: $N {start|stop|restart}" >&2
	exit 1
	;;
esac

exit 0


syntax highlighted by Code2HTML, v. 0.9.1