Linux时间同步

Linux的时间分为System Clock(系统时间)和Real Time Clock (硬件时间)

1. 同步前:

  • 查看系统时间:# date
  • 查看硬件时间:# hwclock --show 或者 # hwclock

2. 设置系统时间与网络时间同步:

  • 安装ntpdate工具:# yum -y install ntp ntpdate
  • 同步网络时间:# ntpdate 0.cn.pool.ntp.org
  • 将系统时间写入硬件时间:# hwclock --systohc

3. 定时同步:

  • # vi /etc/crontab
  • # 10 5 * * * root (/usr/sbin/ntpdate 0.cn.pool.ntp.org && /sbin/hwclock -w) &> /var/log/ntpdate.log
原文地址:https://www.cnblogs.com/light-sunset/p/12742819.html