svn commit: r187782 - in head: etc/rc.d share/man/man5

Giorgos Keramidas keramida at
Wed Jan 28 22:41:14 PST 2009

On Thu, 29 Jan 2009 13:28:39 +0800, Rong-en Fan <grafan at> wrote:
>>> Shouldn't we keep ntp running after the clock is adjusted?
>> This is correct too.  The effect of `ntpd_sync_on_start' is supposed to
>> be the same as if we run `ntpdate' before the real ntpd starts, so this
>> option only applies to the first sync-once instance of ntpd.  The real
>> ntpd starts later, and finds the clock pre-synced.
> Hmm... I think I'm confused. According to rc.d/ntpd, if ntpd_sync_on_start
> is set to yes, it adds '-q -g' to rc_flags. By doing so, ntpd start makes
> ntpd exists immediately after the first sync. Then, who is responsible
> to start the "real ntpd" you said above?

Oops, testing with ntpd_sync_on_start again I think I broke rc.d/ntpd.

I thought precmd was run in _addition_ to the start rc command, but it
only runs before it and affects the flags of start too.  I think I'll
back out the change until we the sync on start for real.

The folowing seems to work much better, but it shows a duplicate message
about `Starting ntpd.' so I have reverted the broken change until I've
worked through the patch a bit more:

diff -r 0c625c73ecc0 etc/rc.d/ntpd
--- a/etc/rc.d/ntpd	Wed Jan 28 18:38:39 2009 +0200
+++ b/etc/rc.d/ntpd	Thu Jan 29 08:40:43 2009 +0200
@@ -8,29 +8,48 @@
 # KEYWORD: nojail shutdown
 . /etc/rc.subr
 load_rc_config $name
+	rc_flags="-c ${ntpd_config} ${ntpd_flags}"
+	# Emulate ntpdate by running once and disabling threshold checks.
+	local _rc_flags_save="${rc_flags}"
+	local _sync_on_start="${ntpd_sync_on_start}"
+	rc_flags="-q -g $rc_flags"
+	ntpd_sync_on_start="NO"			# Avoid recursion in the next `start'
+	run_rc_command start
+	rc_flags="${_rc_flags_save}"
+	ntpd_sync_on_start="${_sync_on_start}"
 	rc_flags="-c ${ntpd_config} ${ntpd_flags}"
 	if checkyesno ntpd_sync_on_start; then
-		rc_flags="-q -g $rc_flags"
+		run_rc_command sync
 	if [ -z "$ntpd_chrootdir" ]; then
 		return 0;
 	# If running in a chroot cage, ensure that the appropriate files
 	# exist inside the cage, as well as helper symlinks into the cage
 	# from outside.

More information about the svn-src-head mailing list