[39f01ca] | 1 | <sect2>
|
---|
[1c36436] | 2 | <title>Configuring <application><acronym>NTP</acronym></application></title>
|
---|
[39f01ca] | 3 |
|
---|
| 4 | <sect3><title>Config files</title>
|
---|
| 5 | <para><filename>/etc/ntp.conf</filename></para>
|
---|
| 6 | </sect3>
|
---|
| 7 |
|
---|
| 8 | <sect3><title>Configuration Information</title>
|
---|
| 9 |
|
---|
| 10 | <para>The following configuration file defines various <acronym>NTP</acronym>
|
---|
| 11 | servers to use with the primary server designated with the prefer tag. It also
|
---|
| 12 | creates a drift file where <command>ntpd</command> stores the frequency
|
---|
[1c36436] | 13 | offset. Since the documentation included with the package is sparse,
|
---|
| 14 | visit the <acronym>NTP</acronym> website at
|
---|
[39f01ca] | 15 | <ulink url="http://www.ntp.org/"/> for more information.</para>
|
---|
| 16 |
|
---|
| 17 | <screen><userinput>server time-a.nist.gov prefer
|
---|
| 18 | server time-b.nist.gov
|
---|
| 19 | server tick.usno.navy.mil
|
---|
| 20 | driftfile /var/cache/ntp.drift</userinput></screen>
|
---|
| 21 | </sect3>
|
---|
| 22 |
|
---|
| 23 | <sect3><title>Synchronizing the time</title>
|
---|
| 24 |
|
---|
| 25 | <para>There are two options. Option one is to use run <command>ntpd</command>
|
---|
[9491ec6b] | 26 | continuously and allow it to synchronize the time in a gradual manner. The other
|
---|
[39f01ca] | 27 | option is to run <command>ntpd</command> periodically (using cron)
|
---|
| 28 | and update the time each time <command>ntpd</command> is scheduled.</para>
|
---|
| 29 |
|
---|
| 30 | <para>If you choose Option one, then create the bootscript
|
---|
| 31 | <filename>/etc/rc.d/init.d/ntp</filename> and put the start and
|
---|
| 32 | stop symlinks:</para>
|
---|
[1c36436] | 33 |
|
---|
[3332aad] | 34 | <screen><userinput><command>cat > /etc/rc.d/init.d/ntp << "EOF"</command>
|
---|
[369af35a] | 35 | #!/bin/sh
|
---|
[39f01ca] | 36 | # Begin $rc_base/init.d/ntp
|
---|
[369af35a] | 37 | . /etc/sysconfig/rc
|
---|
| 38 | . $rc_functions
|
---|
[39f01ca] | 39 | case "$1" in
|
---|
| 40 | start)
|
---|
| 41 | echo "Starting ntpd..."
|
---|
| 42 | loadproc ntpd
|
---|
| 43 | ;;
|
---|
| 44 | stop)
|
---|
| 45 | echo "Stopping ntpd..."
|
---|
| 46 | killproc ntpd
|
---|
| 47 | ;;
|
---|
| 48 | restart)
|
---|
| 49 | $0 stop
|
---|
| 50 | sleep 1
|
---|
| 51 | $0 start
|
---|
| 52 | ;;
|
---|
| 53 | status)
|
---|
| 54 | statusproc ntpd
|
---|
| 55 | ;;
|
---|
| 56 | *)
|
---|
| 57 | echo "Usage: $0 {start|stop|restart|status}"
|
---|
| 58 | exit 1
|
---|
| 59 | ;;
|
---|
| 60 | esac
|
---|
[3332aad] | 61 | # End $rc_base/init.d/ntp
|
---|
| 62 | <command>EOF
|
---|
[3150274] | 63 | chmod 755 /etc/rc.d/init.d/ntp &&
|
---|
[3332aad] | 64 | cd /etc/rc.d/init.d &&
|
---|
| 65 | ln -sf ../init.d/ntp ../rc0.d/K46ntp &&
|
---|
| 66 | ln -sf ../init.d/ntp ../rc1.d/K46ntp &&
|
---|
| 67 | ln -sf ../init.d/ntp ../rc2.d/K46ntp &&
|
---|
| 68 | ln -sf ../init.d/ntp ../rc3.d/S26ntp &&
|
---|
| 69 | ln -sf ../init.d/ntp ../rc4.d/S26ntp &&
|
---|
| 70 | ln -sf ../init.d/ntp ../rc5.d/S26ntp &&
|
---|
| 71 | ln -sf ../init.d/ntp ../rc6.d/K46ntp</command></userinput></screen>
|
---|
[39f01ca] | 72 |
|
---|
| 73 | <para>If you prefer to start ntpd periodically, add the following command to
|
---|
| 74 | the root's <filename>crontab</filename>:</para>
|
---|
| 75 | <screen><userinput>ntpd -q</userinput></screen>
|
---|
| 76 |
|
---|
| 77 | </sect3>
|
---|
| 78 |
|
---|
| 79 | </sect2>
|
---|