#!/bin/sh
#
# $FreeBSD: ports/mail/spamd/files/obspamd.in,v 1.2 2007/07/04 06:11:36 miwi Exp $
#
# PROVIDE: obspamd
# REQUIRE: NETWORKING SERVERS syslogd named
# BEFORE: DAEMON
# KEYWORD: shutdown
#
# Define these spamd_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
#
# obspamd_enable="YES" # Run the spamd(8) daemon (YES/NO).
# obspamd_flags="" # Extra flags for spamd(8) (if enabled).
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
obspamd_enable=${obspamd_enable:-"NO"}
obspamd_flags=${obspamd_flags:-""}
. %%RC_SUBR%%
name="obspamd"
rcvar=`set_rcvar`
command="%%PREFIX%%/libexec/spamd"
start_precmd="obspamd_precmd"
start_postcmd="obspamd_postcmd"
restart_postcmd="obspamd_postcmd"
pidfile="/var/run/spamd.pid"
obspamd_precmd()
{
_rc=0
echo "${obspamd_flags}" | grep "\-b" 2>&1 > /dev/null
if [ $? -eq 1 ]; then
/sbin/mount -p | grep 'fdescfs.*/dev/fd.*fdescfs.*rw' 2>&1 > /dev/null
_rc=${?}
if [ ${_rc} -ne 0 ]; then
echo "Unable to start spamd in greylisting mode"
echo ""
echo "Please mount fdescfs with the following line in /etc/fstab"
echo ""
echo " fdescfs /dev/fd fdescfs rw 0 0"
echo ""
fi
return ${_rc}
fi
}
obspamd_postcmd()
{
if [ -x %%PREFIX%%/sbin/spamd-setup ]; then
if [ -r %%PREFIX%%/etc/spamd/spamd.conf ]; then
%%PREFIX%%/sbin/spamd-setup &
fi
fi
}
load_rc_config $name
run_rc_command "$1"
syntax highlighted by Code2HTML, v. 0.9.1