【CentOS】CentOS7 自动同步时间:服务ntp,命令ntpdate

ntp的安装配置

安装ntp

$ yum -y install ntp

启动ntp服务器

$ systemctl start ntpd

 

配置计划任务,使用ntpdate同步时间

# 启动并开机启动计划任务cron
$ systemctl start crond
$ systemctl enable crond

# 配置计划任务,每5分钟同步一次
$ crontab -e
*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com
得意时做事,失意时读书
原文地址:https://www.cnblogs.com/lanse1993/p/12524314.html