mirror of
https://github.com/Zeckmathederg/glfs.git
synced 2025-02-08 18:47:25 +08:00
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@1776 af4574ff-66df-0310-9fd7-8a98e5e911e0
80 lines
2.6 KiB
XML
80 lines
2.6 KiB
XML
<sect2>
|
|
<title>Configuring <application><acronym>NTP</acronym></application></title>
|
|
|
|
<sect3><title>Config files</title>
|
|
<para><filename>/etc/ntp.conf</filename></para>
|
|
</sect3>
|
|
|
|
<sect3><title>Configuration Information</title>
|
|
|
|
<para>The following configuration file defines various <acronym>NTP</acronym>
|
|
servers to use with the primary server designated with the prefer tag. It also
|
|
creates a drift file where <command>ntpd</command> stores the frequency
|
|
offset. Since the documentation included with the package is sparse,
|
|
visit the <acronym>NTP</acronym> website at
|
|
<ulink url="http://www.ntp.org/"/> for more information.</para>
|
|
|
|
<screen><userinput>server time-a.nist.gov prefer
|
|
server time-b.nist.gov
|
|
server tick.usno.navy.mil
|
|
driftfile /var/cache/ntp.drift</userinput></screen>
|
|
</sect3>
|
|
|
|
<sect3><title>Synchronizing the time</title>
|
|
|
|
<para>There are two options. Option one is to use run <command>ntpd</command>
|
|
continuously and allow it to synchronize the time in a gradual manner. The other
|
|
option is to run <command>ntpd</command> periodically (using cron)
|
|
and update the time each time <command>ntpd</command> is scheduled.</para>
|
|
|
|
<para>If you choose Option one, then create the bootscript
|
|
<filename>/etc/rc.d/init.d/ntp</filename> and put the start and
|
|
stop symlinks:</para>
|
|
|
|
<screen><userinput><command>cat > /etc/rc.d/init.d/ntp << "EOF"</command>
|
|
#!/bin/sh
|
|
# Begin $rc_base/init.d/ntp
|
|
. /etc/sysconfig/rc
|
|
. $rc_functions
|
|
case "$1" in
|
|
start)
|
|
echo "Starting ntpd..."
|
|
loadproc ntpd
|
|
;;
|
|
stop)
|
|
echo "Stopping ntpd..."
|
|
killproc ntpd
|
|
;;
|
|
restart)
|
|
$0 stop
|
|
sleep 1
|
|
$0 start
|
|
;;
|
|
status)
|
|
statusproc ntpd
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|status}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
# End $rc_base/init.d/ntp
|
|
<command>EOF
|
|
chmod 755 /etc/rc.d/init.d/ntp &&
|
|
cd /etc/rc.d/init.d &&
|
|
ln -sf ../init.d/ntp ../rc0.d/K46ntp &&
|
|
ln -sf ../init.d/ntp ../rc1.d/K46ntp &&
|
|
ln -sf ../init.d/ntp ../rc2.d/K46ntp &&
|
|
ln -sf ../init.d/ntp ../rc3.d/S26ntp &&
|
|
ln -sf ../init.d/ntp ../rc4.d/S26ntp &&
|
|
ln -sf ../init.d/ntp ../rc5.d/S26ntp &&
|
|
ln -sf ../init.d/ntp ../rc6.d/K46ntp</command></userinput></screen>
|
|
|
|
<para>If you prefer to start ntpd periodically, add the following command to
|
|
the root's <filename>crontab</filename>:</para>
|
|
<screen><userinput>ntpd -q</userinput></screen>
|
|
|
|
</sect3>
|
|
|
|
</sect2>
|