diff options
author | seanc <seanc@FreeBSD.org> | 2004-09-15 01:08:33 +0000 |
---|---|---|
committer | seanc <seanc@FreeBSD.org> | 2004-09-15 01:08:33 +0000 |
commit | 7580811af241e6fadea3a8a44c705fbacf34f4f9 (patch) | |
tree | de3b35887f4b438a81cdf75984c429f089afb62b /etc/rc.d/ntpdate | |
parent | acc591febcb8abed8cedc09092433e572b5ebeea (diff) | |
download | FreeBSD-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
Diffstat (limited to 'etc/rc.d/ntpdate')
-rwxr-xr-x | etc/rc.d/ntpdate | 34 |
1 files changed, 34 insertions, 0 deletions
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" |