blob: a5bf457e9ce4d6ffd38de7f22b9d5bff233fe2ce (
plain)
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
|
#!/bin/sh
# PROVIDE: inadyn
# REQUIRE: NETWORKING
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# inadyn_enable (bool): Set it to "YES" to enable inadyn
# Default is "NO"
# inadyn_config (str): Set full path to configuration file.
# Default is "%%PREFIX%%/etc/inadyn.conf"
# inadyn_pidfile (str): Set full path to pid file.
# Default is "/var/run/inadyn/inadyn.pid"
#
. /etc/rc.subr
name="inadyn"
rcvar=inadyn_enable
start_precmd="inadyn_checkconfig"
restart_precmd="inadyn_checkconfig"
configtest_precmd="inadyn_checkconfig"
extra_commands="configtest"
load_rc_config $name
: ${inadyn_enable:="NO"}
: ${inadyn_config:="%%PREFIX%%/etc/inadyn.conf"}
: ${inadyn_pidfile:="/var/run/inadyn/inadyn.pid"}
command=%%PREFIX%%/sbin/inadyn
command_args="-p inadyn:inadyn -f ${inadyn_config} -P ${inadyn_pidfile}"
pidfile=${inadyn_pidfile}
required_files=${inadyn_config}
inadyn_checkconfig()
{
echo "Performing sanity check on ${name} configuration:"
eval ${command} ${command_args} --check-config
piddir="$(dirname ${pidfile})"
if [ ! -d "${piddir}" ] && id inadyn >/dev/null 2>&1 ; then
mkdir -p "${piddir}"
chown inadyn:inadyn "${piddir}"
fi
}
run_rc_command "$1"
|