| | 1 | [[PageOutline]] |
| | 2 | |
| | 3 | = ntpd = |
| | 4 | |
| | 5 | == CentOSとUbuntuの起動時のhardware clockのsyncについて == |
| | 6 | === CentOS 5 === |
| | 7 | * /etc/sysconfig/ntpd |
| | 8 | {{{ |
| | 9 | # Set to 'yes' to sync hw clock after successful ntpdate |
| | 10 | SYNC_HWCLOCK=yes |
| | 11 | }}} |
| | 12 | * /etc/ntp/step-tickers |
| | 13 | * このファイルにホストが羅列されている場合、ntpd起動前にntpdateでupdateする |
| | 14 | * /etc/init.d/ntpd |
| | 15 | * boot時に実行されるスクリプトでは、以下のような流れになっている |
| | 16 | {{{ |
| | 17 | echo -n $"$prog: Synchronizing with time server: " |
| | 18 | /usr/sbin/ntpdate $dropstr -s -b $NTPDATE_OPTIONS $tickers &>/dev/null |
| | 19 | }}} |
| | 20 | {{{ |
| | 21 | [ "$SYNC_HWCLOCK" = "yes" ] && sync_hwclock |
| | 22 | }}} |
| | 23 | * sync_hwclock() は以下のようになっている |
| | 24 | {{{ |
| | 25 | action $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS |
| | 26 | }}} |
| | 27 | * $CLOCKFLAGSは「--systohc」の他、環境に合わせてUTCなどを指定する引数がセットされている。 |
| | 28 | |
| | 29 | * shutdown時はH/W clockとの同期は行ってない模様。 |