[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 |
|
---|
[e8889a20] | 17 | <screen><userinput><command>cat > /etc/ntp.conf << "EOF"</command>
|
---|
| 18 | server time-a.nist.gov prefer
|
---|
[39f01ca] | 19 | server time-b.nist.gov
|
---|
| 20 | server tick.usno.navy.mil
|
---|
[e8889a20] | 21 | driftfile /var/cache/ntp.drift
|
---|
| 22 | <command>EOF</command></userinput></screen>
|
---|
[39f01ca] | 23 | </sect3>
|
---|
| 24 |
|
---|
| 25 | <sect3><title>Synchronizing the time</title>
|
---|
| 26 |
|
---|
| 27 | <para>There are two options. Option one is to use run <command>ntpd</command>
|
---|
[9491ec6b] | 28 | continuously and allow it to synchronize the time in a gradual manner. The other
|
---|
[39f01ca] | 29 | option is to run <command>ntpd</command> periodically (using cron)
|
---|
| 30 | and update the time each time <command>ntpd</command> is scheduled.</para>
|
---|
| 31 |
|
---|
| 32 | <para>If you choose Option one, then create the bootscript
|
---|
| 33 | <filename>/etc/rc.d/init.d/ntp</filename> and put the start and
|
---|
| 34 | stop symlinks:</para>
|
---|
[1c36436] | 35 |
|
---|
[3332aad] | 36 | <screen><userinput><command>cat > /etc/rc.d/init.d/ntp << "EOF"</command>
|
---|
[369af35a] | 37 | #!/bin/sh
|
---|
[39f01ca] | 38 | # Begin $rc_base/init.d/ntp
|
---|
[369af35a] | 39 | . /etc/sysconfig/rc
|
---|
| 40 | . $rc_functions
|
---|
[39f01ca] | 41 | case "$1" in
|
---|
| 42 | start)
|
---|
| 43 | echo "Starting ntpd..."
|
---|
| 44 | loadproc ntpd
|
---|
| 45 | ;;
|
---|
| 46 | stop)
|
---|
| 47 | echo "Stopping ntpd..."
|
---|
| 48 | killproc ntpd
|
---|
| 49 | ;;
|
---|
| 50 | restart)
|
---|
| 51 | $0 stop
|
---|
| 52 | sleep 1
|
---|
| 53 | $0 start
|
---|
| 54 | ;;
|
---|
| 55 | status)
|
---|
| 56 | statusproc ntpd
|
---|
| 57 | ;;
|
---|
| 58 | *)
|
---|
| 59 | echo "Usage: $0 {start|stop|restart|status}"
|
---|
| 60 | exit 1
|
---|
| 61 | ;;
|
---|
| 62 | esac
|
---|
[3332aad] | 63 | # End $rc_base/init.d/ntp
|
---|
| 64 | <command>EOF
|
---|
[3150274] | 65 | chmod 755 /etc/rc.d/init.d/ntp &&
|
---|
[3332aad] | 66 | cd /etc/rc.d/init.d &&
|
---|
| 67 | ln -sf ../init.d/ntp ../rc0.d/K46ntp &&
|
---|
| 68 | ln -sf ../init.d/ntp ../rc1.d/K46ntp &&
|
---|
| 69 | ln -sf ../init.d/ntp ../rc2.d/K46ntp &&
|
---|
| 70 | ln -sf ../init.d/ntp ../rc3.d/S26ntp &&
|
---|
| 71 | ln -sf ../init.d/ntp ../rc4.d/S26ntp &&
|
---|
| 72 | ln -sf ../init.d/ntp ../rc5.d/S26ntp &&
|
---|
| 73 | ln -sf ../init.d/ntp ../rc6.d/K46ntp</command></userinput></screen>
|
---|
[39f01ca] | 74 |
|
---|
| 75 | <para>If you prefer to start ntpd periodically, add the following command to
|
---|
| 76 | the root's <filename>crontab</filename>:</para>
|
---|
| 77 | <screen><userinput>ntpd -q</userinput></screen>
|
---|
| 78 |
|
---|
| 79 | </sect3>
|
---|
| 80 |
|
---|
| 81 | </sect2>
|
---|