summaryrefslogtreecommitdiff
path: root/mail/spamd/files/obspamlogd.in
blob: c497e8b4b64aa16cd8cb7b3d9a779704093edefb (plain) (blame)
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
#!/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).
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE
#
obspamlogd_enable=${obspamlogd_enable:-"NO"}

. %%RC_SUBR%%

name="obspamlogd"
rcvar=`set_rcvar`

command="%%PREFIX%%/libexec/spamlogd"
start_precmd="obspamlogd_precmd"
stop_postcmd="obspamlogd_cleanup"
pidfile="/var/run/spamlogd.pid"

obspamlogd_precmd()
{
	_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()
{
	/bin/rm -f ${pidfile}
}

load_rc_config $name
run_rc_command "$1"