diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index f82addf7b47..316705e341f 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -260,6 +260,7 @@ ntpdate_program="/usr/sbin/ntpdate" # path to ntpdate, if you want a different o 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_config="/etc/ntp.conf" # ntpd(8) configuration file 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/ntpd b/etc/rc.d/ntpd index 5cc7aac2e6a..ba01b436a45 100755 --- a/etc/rc.d/ntpd +++ b/etc/rc.d/ntpd @@ -15,12 +15,17 @@ rcvar=`set_rcvar` command="/usr/sbin/${name}" pidfile="/var/run/${name}.pid" start_precmd="ntpd_precmd" -required_files="/etc/ntp.conf" + +load_rc_config $name + +required_files="${ntpd_config}" ntpd_precmd() { + rc_flags="-c ${ntpd_config} ${ntpd_flags}" + if checkyesno ntpd_sync_on_start; then - rc_flags="-g ${ntpd_flags}" + rc_flags="-g $rc_flags" fi if [ -z "$ntpd_chrootdir" ]; then @@ -47,5 +52,4 @@ ntpd_precmd() rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags" } -load_rc_config $name run_rc_command "$1" diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index cc404a6daac..5a8b2766d01 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 8, 2006 +.Dd April 18, 2006 .Dt RC.CONF 5 .Os .Sh NAME @@ -1804,6 +1804,13 @@ Path to .Xr ntpd 8 (default .Pa /usr/sbin/ntpd ) . +.It Va ntpd_config +.Pq Vt str +Path to +.Xr ntpd 8 +configuration file. +(default +.Pa /etc/ntp.conf ) . .It Va ntpd_flags .Pq Vt str If