ntp时间同步

1:开机同步

开机时自动同步可编辑 /etc/ntp/step-tickers 文件

1 vim /etc/ntp/step-tickers
2 
3 # List of NTP servers used by the ntpdate service.
4 
5 ntp.aliyun.com
6 time2.aliyun.com
7 ntp2.aliyun.com

2:定时同步可使用 crontab,添加定时任务

systemctl start crond

systemctl enable crond

# 添加
crontab -e

# 每两个小时同步一次
0 */2 * * * ntpdate s2m.time.edu.cn && hwclock -w

# 查看
crontab –l

posted @ 2021-06-17 10:15  蒲城小农  阅读(101)  评论(0编辑  收藏  举报