summaryrefslogtreecommitdiff
path: root/mail/dcc-dccd/files/dccgrey.sh.in
blob: e578bf7df26a69a7cb026f50e82bf2222aec8df6 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
#
# PROVIDE: dccgrey
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf:
#
#dccgrey_enable="YES"
#
# and in %%DCCHOME%%/dcc_conf change:
#
#GREY_ENABLE=
#
# to:
#
#GREY_ENABLE=on
#
#
# See %%DCCHOME%%/dcc_conf to configure startup options
#

. %%RC_SUBR%%

name=dccgrey
rcvar=`set_rcvar`

load_rc_config $name

# Set defaults
: ${dccgrey_enable:="NO"}
: ${dccgrey_home="%%DCCHOME%%"}
: ${dccgrey_libexec="%%PREFIX%%/dcc/libexec"}
: ${dccgrey_conf="$dccgrey_home/dcc_conf"}


procname="${dccgrey_libexec}/dccd"
required_dirs="${dccgrey_home} ${dccgrey_libexec}"
required_files="${dccgrey_conf} ${dccgrey_libexec}/rcDCC"

start_cmd="start_dccgrey"
stop_cmd="stop_dccgrey"
start_precmd="start_precmd"


start_precmd()
{
X=`grep ^GREY_ENABLE ${dccgrey_conf}`
eval $X
if [ "$GREY_ENABLE" != "on" ]
then
	echo "Warning ${X} needs to be on in ${dccgrey_conf} to start the DCC greylisting server"
	return 1
fi
}

start_dccgrey()
{
	echo Starting dccgrey.
	${dccgrey_libexec}/rcDCC -m grey start
}

stop_dccgrey()
{
	echo Stopping dccgrey.
	${dccgrey_libexec}/rcDCC -m grey stop
}

run_rc_command "$1"