ハードウェアクロックのシステムクロックとの同期 [Linux]
詳細は、以下の通りである。
1. 状況と対処方法
(1) CentOS 6
シャットダウン、またはリブート時に実施される。
(/etc/init.d/halt)
(2) Debian 7
シャットダウン、またはリブート時に実施される。
(/etc/rc{0,6}.d/K08hwclock.sh -> /etc/init.d/hwclock.sh)
(3) Debian 8 (systemd、ntpd を使用)
実施されない(chronyd を使用する場合を除く)。
このため、下記の対応を実施する。
(a) /usr/sbin/halt.local というファイル名のシェルスクリプトの作成
halt-local.service で実行される。
(b) /usr/sbin/halt.local への設定
下記の設定を追加する。
# synchronize the hardware clock to the system time hwclock --systohc
(c) halt-local.service の自動起動の設定
自動起動が無効化されている(disabled と出力される)場合には、有効化する。
# systemctl status halt-local.service (または # systemctl list-unit-files halt-local.service) # systemctl enable halt-local.service
(4) CentOS 7 (systemd、ntpd を使用)
実施されない(chronyd を使用する場合を除く)。
このため、下記の対応を実施する。
(a) /usr/sbin/halt.local の作成
halt-local.service で実行される。
(b) /usr/sbin/halt.local への設定
下記の設定を追加する。
# synchronize the hardware clock to the system time hwclock --systohc
(c) halt-local.service の自動起動の設定
自動起動が無効化されている(disabled と出力される)場合には、有効化する。
# systemctl status halt-local.service (または # systemctl list-unit-files halt-local.service) # systemctl enable halt-local.service
2. 備考
ログ: /etc/adjtime
コメント 0