centos7 ntp时间设置

安装ntp

yum -y install ntp


1、设置每天早晨5点钟同步时间:

# vi /etc/crontab


添加以下内容

0 5 * * * root /usr/sbin/ntpdate  pool.ntp.org && /sbin/hwclock -w


2、设置ntp服务开机启动

# systemctl enable ntpd.service


3、启动ntp服务

# systemctl start ntpd.service


4、验证ntp服务已经运行

# pgrep ntpd


你可能感兴趣的:(ntp)