blob: 81d31496c68f069e409a98b75f0379e3b21010df (
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
|
#! /bin/sh
#
# PROVIDE: radns
# REQUIRE: DAEMON LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable radns:
#
# radns_enable (bool): Set it to "YES" to enable radns
# Default is "NO".
# radns_resolv (path): Full path to radns' own resolv.conf
# radns_pidfile (path): Full path to pid file.
# radns_script (path): Full path to script file or empty string if no script.
# radns_username (user): Username the daemon will run as.
#
. /etc/rc.subr
name=radns
rcvar=`set_rcvar`
radns_dir="%%PREFIX%%/etc/radns"
load_rc_config $name
# Default values
: ${radns_enable="NO"}
: ${radns_pidfile="/var/run/${name}.pid"}
: ${radns_resolv="${radns_dir}/radns-resolv.conf"}
: ${radns_script=""}
: ${radns_username="radns"}
command="%%PREFIX%%/bin/${name}"
start_precmd=start_precmd
stop_postcmd=stop_postcmd
start_precmd()
{
[ -d ${radns_dir} ] || mkdir ${radns_dir}
chown ${radns_username} ${radns_dir}
}
stop_postcmd()
{
rm -f ${radns_resolv}
rm -f ${radns_pidfile}
}
# if script:
if [ x${radns_script} != "x" ]
then
command_args="-f ${radns_resolv} -s ${radns_script} -u ${radns_username} \
-p ${radns_pidfile}"
else
command_args="-f ${radns_resolv} -u ${radns_username} -p ${radns_pidfile}"
fi
reload_precmd()
{
echo "Stopping ${name} and start gracefully."
}
reload_postcmd()
{
rm -f ${radns_pidfile}
run_rc_command start
}
# actually execute the program
run_rc_command "$1"
|