summaryrefslogtreecommitdiff
path: root/net/openntpd/files/openntpd.in
blob: 8b5ed9c4fb3120178500a865abc617916e5f7090 (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
#!/bin/sh

# PROVIDE: openntpd
# REQUIRE: DAEMON ntpdate
# BEFORE:  LOGIN
# KEYWORD: nojail shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# openntpd_enable (bool):	Set to NO by default.
#				Set it to YES to enable openntpd.
# openntpd_config (str):	Path to ntpd.conf
#				Default: %%PREFIX%%/etc/ntpd.conf
# openntpd_flags (str):		Flags passed to ntpd(8)
#				Default: none

. /etc/rc.subr

name=openntpd
rcvar=openntpd_enable

start_precmd="openntpd_checkconfig"
restart_precmd="openntpd_checkconfig"
configtest_cmd="openntpd_checkconfig"
extra_commands="configtest"

load_rc_config $name

: ${openntpd_enable:="NO"}
: ${openntpd_config:="%%PREFIX%%/etc/ntpd.conf"}

command=%%PREFIX%%/sbin/ntpd
command_args="-f ${openntpd_config}"
required_files=${openntpd_config}

check_process()
{
        pgrep -f $command
}

openntpd_checkconfig()
{
	echo "Performing sanity check on ${name} configuration:"
	eval ${command} ${command_args} ${openntpd_flags} -n
}

run_rc_command "$1"