#!/bin/sh
#
# PROVIDE: spampd
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown
#
# Add the fellowing line to /etc/rc.conf to enable spampd:
#
# spampd_enable (bool):		Set it to "YES" to enable spampd
#				Default is "NO"
# spampd_flags:			Flags to spampd
# spampd_extra_flags:		Additional flags, so one can
#                               keep defaults in spampd_flags, e.g.
#                               spampd_extra_flags="--sef" to add
#                               "X-Envelope-From" header.

. /etc/rc.subr

name="spampd"
rcvar=spampd_enable

: ${spampd_enable="NO"}
: ${spampd_pidfile="/var/run/spamd/spampd.pid"}
: ${spampd_flags="--user=spamd --group=spamd --homedir=/var/spool/spamd --host=127.0.0.1:10025 --relayhost=127.0.0.1:10026 --dose --tagall"}
load_rc_config $name

command="%%PREFIX%%/sbin/$name"
command_args="--setsid --pid=${spampd_pidfile} ${spampd_extra_flags}"
command_interpreter="%%PERL%% -T"
pidfile="${spampd_pidfile}"

run_rc_command $1
