From 0050f9ec3cd5e116f08d0269d78d8574a2432103 Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Tue, 14 Sep 2004 03:01:38 +0000 Subject: [PATCH] Stop using ntpdate(1) in our startup proceedure. Replace ntpdate(1) with calls to ntpd -g. ntpd is noticably 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's use 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) --- UPDATING | 10 ++++++++++ etc/defaults/rc.conf | 4 +--- etc/rc.d/Makefile | 2 +- etc/rc.d/ntpd | 5 +++++ etc/rc.d/rpcbind | 2 +- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/UPDATING b/UPDATING index 158f43fc5bf5..30161192c1bc 100644 --- a/UPDATING +++ b/UPDATING @@ -23,6 +23,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 6.x IS SLOW: developers choose to disable these features on build machines to maximize performance. +20040914: + /etc/rc.d/ntpdate has been removed in favor of using the -g + flag to ntpd(1). By default, if ntpd is enabled, it will sync + with the time servers listed in /etc/ntp.conf regardless of the + time difference (slew). To prevent this, add + ntpd_sync_on_start="NO" to /etc/rc.conf. + + NOTE: Doing a sync (ntpd -g) is noticably slower than ntpdate(1), + but is also more accurate (hence ntpdate(1) being depreciated). + 20040914: The format of the pflogd(8) logfile "/var/log/pflog" has changed for architectures that have a 64 bit long type to make it compatible to diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index 94eb637aef54..792b53b39ffe 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -219,11 +219,9 @@ keyserv_flags="" # Flags to keyserv (if enabled). ### Network Time Services options: ### timed_enable="NO" # Run the time daemon (or NO). timed_flags="" # Flags to timed (if enabled). -ntpdate_enable="NO" # Run ntpdate to sync time on boot (or NO). -ntpdate_program="/usr/sbin/ntpdate" # path to ntpdate, if you want a different one. -ntpdate_flags="-b" # Flags to ntpdate (if enabled). ntpd_enable="NO" # Run ntpd Network Time Protocol (or NO). ntpd_program="/usr/sbin/ntpd" # path to ntpd, if you want a different one. +ntpd_sync_on_start="YES" # Sync time on ntpd startup, even if offset is high ntpd_flags="-p /var/run/ntpd.pid -f /var/db/ntpd.drift" # Flags to ntpd (if enabled). diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile index 61bc3e826cf9..690256d46924 100755 --- a/etc/rc.d/Makefile +++ b/etc/rc.d/Makefile @@ -23,7 +23,7 @@ FILES= DAEMON LOGIN NETWORKING SERVERS \ mountd moused mroute6d mrouted msgs \ named natd netif netoptions \ network_ipv6 nfsclient nfsd \ - nfslocking nfsserver nisdomain nsswitch ntpd ntpdate \ + nfslocking nfsserver nisdomain nsswitch ntpd \ othermta \ pccard pcvt pf pflog preseedrandom \ power_profile ppp-user pppoed pwcheck \ diff --git a/etc/rc.d/ntpd b/etc/rc.d/ntpd index 0195b09bf457..d7c8ce1642a7 100755 --- a/etc/rc.d/ntpd +++ b/etc/rc.d/ntpd @@ -15,10 +15,15 @@ name=ntpd rcvar=`set_rcvar` command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" +start_precmd="ntpd_precmd" required_files="/etc/ntp.conf" ntpd_precmd() { + if checkyesno ntpd_sync_on_start; then + rc_flags="-g ${ntpd_flags}" + fi + if [ -z "$ntpd_chrootdir" ]; then return 0; fi diff --git a/etc/rc.d/rpcbind b/etc/rc.d/rpcbind index 8d8d97cbb942..32ef973883bd 100755 --- a/etc/rc.d/rpcbind +++ b/etc/rc.d/rpcbind @@ -5,7 +5,7 @@ # # PROVIDE: rpcbind -# REQUIRE: NETWORKING ntpdate syslogd named +# REQUIRE: NETWORKING ntpd syslogd named # KEYWORD: FreeBSD . /etc/rc.subr