aboutsummaryrefslogtreecommitdiff
path: root/dns/gdnsd3/files/gdnsd.in
blob: 643779a2588796d9f17312c81a1133d29bf2da39 (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
#!/bin/sh

# PROVIDE: gdnsd
# REQUIRE: DAEMON
# REQUIRE: LOGIN
# KEYWORD: FreeBSD shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# gdnsd_enable (bool):	Set to NO by default.
#				Set it to YES to enable gdnsd.
# gdnsd_flags (str):		Set to "" by default
#				Extra command line argument flags

. /etc/rc.subr

name="gdnsd"
rcvar=gdnsd_enable

# set defaults
load_rc_config $name
: ${gdnsd_enable:="NO"}
: ${gdnsd_user:="gdnsd"}
: ${gdnsd_group:="gdnsd"}
: ${gdnsd_flags:=""}

command="%%PREFIX%%/sbin/gdnsd"
command_args="daemonize"
procname=${command}
start_precmd="gdnsd_prestart"
restart_precmd="gdnsd_checkconf"
restart_cmd="gdnsd_restart"
reload_cmd="gdnsd_reload"
reload_precmd="gdnsd_checkconf"
stats_cmd="gdnsd_stats"
configtest_cmd="gdnsd_checkconf"
extra_commands="stats reload configtest"

gdnsd_prestart()
{
  if ! kldstat -q -m mac_portacl; then
    warn "mac_portacl module not loaded, please review pkg-message"
  fi

  install -d -o ${gdnsd_user} -g ${gdnsd_group} -m 700 /var/run/gdnsd
}

gdnsd_reload()
{
  gdnsdctl reload-zones
}

gdnsd_restart()
{
  gdnsdctl replace
}

gdnsd_checkconf()
{
  ${command} ${gdnsd_flags} checkconf
}

gdnsd_stats()
{
  gdnsdctl stats
}

run_rc_command "$1"