blob: 9dac8700056ce55fa46fad7b676683e0e69c9959 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/bin/sh
#
# $FreeBSD$
#
# 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"}
. /etc/rc.subr
name="obspamd"
rcvar=obspamd_enable
command="%%PREFIX%%/libexec/%%SPAMDBIN%%"
start_precmd="obspamd_precmd"
start_postcmd="obspamd_postcmd"
restart_postcmd="obspamd_postcmd"
stop_postcmd="obspamd_cleanup"
pidfile="/var/run/spamd.pid"
obspamd_precmd()
{
_rc=0
echo "${obspamd_flags}" | egrep "(^\-b| \-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
echo "${obspamd_flags}" | egrep "(^\-b| \-b)" 2>&1 > /dev/null
if [ $? -eq 0 ]; then
%%PREFIX%%/sbin/spamd-setup -bD
else
%%PREFIX%%/sbin/spamd-setup -D
fi
fi
fi
}
obspamd_cleanup()
{
/bin/rm -f ${pidfile}
}
load_rc_config $name
run_rc_command "$1"
|