NTP - 校正 Linux 时间
NTP 可以让您与远端的时间服务器同步,以校正 Linux 系统的时间。
安装 NTP 模组
使用 APT 安装 NTP 套件:
apt-get install ntp
手动设定时间
执行下列指令设定 Server 的时间:
date -s "20030605 13:29:00"
与时间服务器的时间同步
执行下列指令即让系统时间与 time.stdtime.gov.tw 的时间同步:
ntpdate -s time.stdtime.gov.tw hwclock --systohc
每天对时
1. 若要设定每天执行一次,可于 /etc/cron.daily 新增指令档 ntpdate.sh,内容如下:
#! /bin/bash ntpdate -s time.stdtime.gov.tw hwclock --systohc
2. 更改档案属性为 755:
chmod 755 /etc/cron.daily/ntpdate.sh
No comments yet.