1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-19 03:52:17 +00:00
freebsd-ports/net/openntpd/files/openntpd.in
Adam Weinberger 4a5694585f Add support for changing the location of ntpd.conf (openntpd_config),
and add a 'configtest' rc(8) target. Also note openntpd_flags in the
comments at the top of the rc(8) script.

PORTREVISION bump for rc(8) script change.

PR:		210153
Approved by:	naddy (maintainer)
2016-06-09 15:47:58 +00:00

51 lines
1.0 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# 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"