1、NTP 设置为中国上海时间并同步

[root@localhost ~]yum install -y ntp
[root@localhost ~]rm -rf /etc/localtime
[root@localhost ~]ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
[root@localhost ~]ntpdate cn.pool.ntp.org
[root@localhost ~]date

2、用crond添加计划任务:

  在最后添加 “3 3 * * * /usr/sbin/ntpdate 0.asia.pool.ntp.org > /dev/null 2>&1 ”,最后重启服务。

[root@localhost ~]# crontab -e
[root@localhost ~]# crontab  -l

3 3 * * * /usr/sbin/ntpdate cn.pool.ntp.org > /dev/null 2>&1

。。。

 [root@localhost ~]# service crond restart
Stopping crond:                                            [  OK  ]
Starting crond:                                            [  OK  ]