修改时区及时间同步

centos6
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

centos7
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

时间同步
[root@test ~]# yum -y install ntpdate

测试时间同步服务器
[root@test ~]# /usr/sbin/ntpdate ntp1.aliyun.com
14 May 09:09:18 ntpdate[1180]: adjust time server 120.25.115.20 offset 0.003479 sec

添加计划任务
*/5 * * * * /usr/sbin/ntpdate ntp1.aliyun.com >/dev/null 2>&1

猜你喜欢

转载自blog.csdn.net/bjgaocp/article/details/90177911