blob: 136c66fe54959d8ff6f4aaa93a6e0c0b93a41084 (
plain) (
tree)
|
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: obspamlogd
# REQUIRE: NETWORKING SERVERS obspamd
# BEFORE: DAEMON
# KEYWORD: shutdown
#
# Define these obspamlogd_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
#
# obspamlogd_enable="YES" # Run the spamlogd(8) daemon (YES/NO).
# obspamlogd_flags="" # Extra flags for spamlogd(8) (if enabled).
# obspamlogd_pflog_if="" # pflog Interface for spamlogd(8) to monitor
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
obspamlogd_enable=${obspamlogd_enable:-"NO"}
. /etc/rc.subr
name="obspamlogd"
rcvar=obspamlogd_enable
command="%%PREFIX%%/libexec/spamlogd"
start_precmd="obspamlogd_precmd"
stop_postcmd="obspamlogd_cleanup"
pidfile="/var/run/spamlogd.pid"
obspamlogd_precmd()
{
if [ ! -z "${obspamlogd_pflog_if}" ]; then
# Configure i/f explicitly
load_kld pflog || {
warn "Unable to kldload pflog module"
return 1
}
if ! ifconfig ${obspamlogd_pflog_if} create up; then
warn "could not bring up ${obspamlogd_pflog_if}"
return 1
fi
rc_flags="${rc_flags} -l ${obspamlogd_pflog_if}"
fi
_rc=0
/sbin/mount -p | grep 'fdescfs.*/dev/fd.*fdescfs.*rw' 2>&1 > /dev/null
_rc=${?}
if [ ${_rc} -ne 0 ]; then
echo "Unable to start ${name}"
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}
}
obspamlogd_cleanup()
{
if [ -n "${obspamlogd_pflog_if}" ]; then
ifconfig ${obspamlogd_pflog_if} destroy
fi
/bin/rm -f ${pidfile}
}
load_rc_config $name
run_rc_command "$1"
|