summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorseanc <seanc@FreeBSD.org>2004-09-15 01:08:33 +0000
committerseanc <seanc@FreeBSD.org>2004-09-15 01:08:33 +0000
commit7580811af241e6fadea3a8a44c705fbacf34f4f9 (patch)
treede3b35887f4b438a81cdf75984c429f089afb62b
parentacc591febcb8abed8cedc09092433e572b5ebeea (diff)
downloadFreeBSD-src-7580811af241e6fadea3a8a44c705fbacf34f4f9.zip
FreeBSD-src-7580811af241e6fadea3a8a44c705fbacf34f4f9.tar.gz
Bring back etc/rc.d/ntpdate as requested by scads of people. This isn't a
complete backout as the ntpd_sync_on_start etc/rc.conf tunable is still present, though the default is now NO (was YES). Since we're no longer syncing time at startup by default when ntpd is enabled (as was the case 24hrs ago), remove UPDATING entry pointing out that ntpd(1) -g is slower than ntpdate(1). Hopefully ntpd_sync_on_start="YES" can be made the default for -CURRENT after 5.3 is cut. At the very least, this should be set to YES when a user requests to have ntpd enabled via sysinstall(1). Requested by: many
-rw-r--r--UPDATING10
-rw-r--r--etc/defaults/rc.conf5
-rwxr-xr-xetc/rc.d/Makefile2
-rwxr-xr-xetc/rc.d/ntpdate34
-rwxr-xr-xetc/rc.d/rpcbind2
5 files changed, 40 insertions, 13 deletions
diff --git a/UPDATING b/UPDATING
index 3016119..158f43f 100644
--- a/UPDATING
+++ b/UPDATING
@@ -24,16 +24,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 6.x IS SLOW:
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
the standard pcap format. In order to prevent corruption move away
diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf
index 792b53b..6fbdf28 100644
--- a/etc/defaults/rc.conf
+++ b/etc/defaults/rc.conf
@@ -219,9 +219,12 @@ 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_sync_on_start="NO" # 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 690256d..61bc3e8 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 \
+ nfslocking nfsserver nisdomain nsswitch ntpd ntpdate \
othermta \
pccard pcvt pf pflog preseedrandom \
power_profile ppp-user pppoed pwcheck \
diff --git a/etc/rc.d/ntpdate b/etc/rc.d/ntpdate
new file mode 100755
index 0000000..a8f1e23
--- /dev/null
+++ b/etc/rc.d/ntpdate
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# $NetBSD: ntpdate,v 1.8 2002/03/22 04:16:39 lukem Exp $
+# $FreeBSD$
+#
+
+# BEFORE: ntpd
+# 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"
diff --git a/etc/rc.d/rpcbind b/etc/rc.d/rpcbind
index 32ef973..8d8d97c 100755
--- a/etc/rc.d/rpcbind
+++ b/etc/rc.d/rpcbind
@@ -5,7 +5,7 @@
#
# PROVIDE: rpcbind
-# REQUIRE: NETWORKING ntpd syslogd named
+# REQUIRE: NETWORKING ntpdate syslogd named
# KEYWORD: FreeBSD
. /etc/rc.subr
OpenPOWER on IntegriCloud