ubuntuで時刻合わせ

ubuntuの時刻にずれがあったので、自動で時刻合わせするようにした。

sudo apt-get install ntp

でインスコして、/etc/ntp.conf の中身を

server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

server ntp1.jst.mfeed.ad.jp
server ntp2.jst.mfeed.ad.jp
server ntp3.jst.mfeed.ad.jp

に変更する。

ほんで、

sudo service ntp stop
sudo ntpdate ntp1.jst.mfeed.ad.jp
sudo hwclock  --systohc
sudo service ntp start

二番目のntpdateで一度時刻合わせしておく。

最後にhwclockもcronで同期を取るようにする。
crontab -e で

15 0 * * * /sbin/hwclock --systohc

と記述する。

いじょ