Lines 12-31
Link Here
|
12 |
|
12 |
|
13 |
. /etc/rc.subr |
13 |
. /etc/rc.subr |
14 |
|
14 |
|
|
|
15 |
case "$0" in |
16 |
/etc/rc*) |
17 |
# during boot (shutdown) $0 is /etc/rc (/etc/rc.shutdown), |
18 |
# so get the name of the script from $_file |
19 |
name="$_file" |
20 |
;; |
21 |
*) |
22 |
name="$0" |
23 |
;; |
24 |
esac |
25 |
|
15 |
desc="dnsdist is a powerful, scriptable DNS loadbalancer" |
26 |
desc="dnsdist is a powerful, scriptable DNS loadbalancer" |
16 |
name=dnsdist |
27 |
name="${name##*/}" |
17 |
rcvar=dnsdist_enable |
28 |
rcvar=${name}_enable |
18 |
|
29 |
|
19 |
load_rc_config ${name} |
30 |
load_rc_config ${name} |
20 |
|
31 |
|
21 |
: ${dnsdist_priv_user:=_dnsdist} |
32 |
eval ": \${${name}_enable:=\"NO\"}" |
22 |
: ${dnsdist_priv_group:=_dnsdist} |
33 |
eval ": \${${name}_priv_user:=\"_dnsdist\"}" |
23 |
: ${dnsdist_enable:=NO} |
34 |
eval ": \${${name}_priv_group:=\"_dnsdist\"}" |
|
|
35 |
eval ": \${${name}_config:=\"/usr/local/etc/${name}.conf\"}" |
24 |
|
36 |
|
25 |
pidfile=/var/run/${name}.pid |
37 |
pidfile=/var/run/${name}.pid |
26 |
|
38 |
|
|
|
39 |
conffile="$(eval echo \${${name}_config})" |
40 |
username="$(eval echo \${${name}_priv_user})" |
41 |
groupname="$(eval echo \${${name}_priv_group})" |
42 |
|
27 |
command=/usr/sbin/daemon |
43 |
command=/usr/sbin/daemon |
28 |
actual_command=/usr/local/sbin/${name} |
44 |
actual_command=/usr/local/sbin/${name} |
29 |
command_args="-c -f -r -P ${pidfile} ${actual_command} -u ${dnsdist_priv_user} -g ${dnsdist_priv_group} --supervised" |
45 |
command_args="-c -f -r -P ${pidfile} ${actual_command} -C ${conffile} -u ${username} -g ${groupname} --supervised" |
30 |
|
46 |
|
31 |
run_rc_command "$1" |
47 |
run_rc_command "$1" |