#!/bin/sh
#
# $FreeBSD: ports/mail/spamass-milter/files/spamass-milter.in,v 1.3 2006/12/01 23:39:44 miwi Exp $
#

# PROVIDE: spamass-milter
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable spamass-milter:
#
#spamass_milter_enable="YES"
#
# See spamass-milter(8) for flags.
#

. %%RC_SUBR%%

name=spamass_milter
rcvar=`set_rcvar`

command=%%PREFIX%%/sbin/spamass-milter
required_dirs=%%PREFIX%%/share/spamassassin

start_postcmd=start_postcmd
stop_postcmd=stop_postcmd

start_postcmd()
{
  if test -f /var/run/sendmail.pid
  then
	sleep 1
	kill -HUP `head -1 /var/run/sendmail.pid`
  fi

  /usr/sbin/chown ${spamass_milter_socket_owner}:${spamass_milter_socket_group} ${spamass_milter_socket}
  /bin/chmod ${spamass_milter_socket_mode} ${spamass_milter_socket}
}

stop_postcmd()
{
  rm -f ${spamass_milter_socket}
  if test -f /var/run/sendmail.pid
  then
	sleep 1
	kill -HUP `head -1 /var/run/sendmail.pid`
  fi
}

load_rc_config $name
: ${spamass_milter_enable="NO"}
: ${spamass_milter_socket="/var/run/spamass-milter.sock"}
: ${spamass_milter_flags="-f -p ${spamass_milter_socket}"}
: ${spamass_milter_socket_owner="root"}
: ${spamass_milter_socket_group="wheel"}
: ${spamass_milter_socket_mode="644"}

run_rc_command "$1"


syntax highlighted by Code2HTML, v. 0.9.1