openbsd-ports/net/ntp/files
ajacoutot 051d194d03 - it's -> its
from Alex J. Avriette <avriette at gmail dot com>
2007-09-17 17:20:44 +00:00
..
README.OpenBSD - it's -> its 2007-09-17 17:20:44 +00:00

Several steps need to be taken to properly configure the NTP daemon.

1) First, create or update the file !!SYSCONFDIR!!/ntp.conf.  Several
   example configuration files can be found here:

     !!PREFIX!!/share/examples/ntp.

2) Next, several command scripts for system startup need to be
   modified.

   (a) Add the following to /etc/rc.securelevel:

       # Securelevel > 1 does not allow the clock to be set backwards
       if [ $securelevel -gt 1 -a X"${xntpdate_flags}" != X"NO" \
	   -a -x /usr/local/sbin/ntpdate ]; then
	       echo -n ' ntpdate'
	        /usr/local/sbin/ntpdate -b ${xntpdate_flags} >/dev/null
       fi

       if [ X"${xntpd}" == X"YES" -a -x /usr/local/sbin/tickadj \
	   -a -e /etc/ntp.conf ]; then
	       echo -n ' tickadj';  /usr/local/sbin/tickadj -Aq
       fi

   (b) Add the following to /etc/rc.local:

       # run ntpdate prior to ntpd
       if [ $securelevel -le 1 -a X"${xntpdate_flags}" != X"NO" \
	   -a -x /usr/local/sbin/ntpdate ]; then
	       echo -n ' ntpdate'
	       /usr/local/sbin/ntpdate -b ${xntpdate_flags} >/dev/null
       fi

       if [ X"${xntpd}" == X"YES" -a -x /usr/local/sbin/ntpd \
	   -a -e /etc/ntp.conf ]; then
	       xntpd_flags="-p /var/run/ntpd.pid"
	       if [ $securelevel -ge 1 ]; then
		   xntpd_flags="${xntpd_flags} -x"
	       fi
	       echo -n ' ntpd'; /usr/local/sbin/ntpd ${xntpd_flags}
       fi

   (c) Then, in /etc/rc.conf, set the following variables accordingly.

       xntpd=YES			# change to NO to disable
       xntpdate_flags="pool.ntp.org"	# set to list of NTP servers

   (refer to rc.conf(8) for more information regarding its use)

3) Finally, restart your system.  The system restart is necessary as
   tickadj is run from /etc/rc.securelevel before the system securelevel
   is raised.