aboutsummaryrefslogtreecommitdiff
path: root/mail/dcc-dccd/files/dccd.sh.in
blob: 1de2096f108ed57a479191fd5def9c7af4d8b4ec (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: dccd
# REQUIRE: LOGIN
# BEFORE: mail
# KEYWORD: shutdown

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

. /etc/rc.subr

name=dccd
rcvar=`set_rcvar`

load_rc_config $name

# Set defaults
: ${dccd_enable:="NO"}
: ${dccd_home="%%DCCHOME%%"}
: ${dccd_libexec="%%PREFIX%%/dcc/libexec"}
: ${dccd_conf="$dccd_home/dcc_conf"}


procname="${dccd_libexec}/dccd"
required_dirs="${dccd_home} ${dccd_libexec}"
required_files="${dccd_conf} ${dccd_libexec}/rcDCC"

start_cmd="start_dccd"
stop_cmd="stop_dccd"
start_precmd="start_precmd"


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

start_dccd()
{
	echo Starting dccd.
	${dccd_libexec}/rcDCC -m dccd start
}

stop_dccd()
{
	echo Stopping dccd.
	${dccd_libexec}/rcDCC -m dccd stop
}

run_rc_command "$1"