Stop using ntpdate(1) in our startup procedure. Replace ntpdate(1) with

calls to ntpd -g.  ntpd is noticeably slower than ntpdate, but is also more
accurate.  This removes the nasty hackery in rc.d/ntpdate that would parse
out ntp servers from /etc/ntp.conf (ntpd knows how to read its own config
file).  By default, ntpd *will* sync with its listed time servers.  To
turn this off so that ntpd does not sync, ntpd_sync_on_start="NO" can be
added to /etc/rc.conf.  If ntpd is not enabled (the default), then time is
not synced on startup.  ntpdate has been depreciated by the ntpd authors
for quite some time so this change shouldn't be unexpected.

Suggested by:	des
Approved by:	roberto (resident ntp guru)
This commit is contained in:
Sean Chittenden 2004-09-14 03:04:50 +00:00
parent 0050f9ec3c
commit 756b0fff51
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135195

View File

@ -1,33 +0,0 @@
#!/bin/sh
#
# $NetBSD: ntpdate,v 1.8 2002/03/22 04:16:39 lukem Exp $
# $FreeBSD$
#
# PROVIDE: ntpdate
# REQUIRE: NETWORKING syslogd
# KEYWORD: FreeBSD nojail
. /etc/rc.subr
name="ntpdate"
rcvar=`set_rcvar`
stop_cmd=":"
start_cmd="ntpdate_start"
ntpdate_start()
{
if [ -z "$ntpdate_hosts" -a -f /etc/ntp.conf ]; then
ntpdate_hosts=`awk '
/^server[ \t]*127.127/ {next}
/^(server|peer)/ {print $2}
' </etc/ntp.conf`
fi
if [ -n "$ntpdate_hosts" -o -n "$rc_flags" ]; then
echo "Setting date via ntp."
${ntpdate_command:-ntpdate} $rc_flags $ntpdate_hosts
fi
}
load_rc_config $name
run_rc_command "$1"