首页 > 系统服务 > 详细

linux 用NTP设定中国时间并同步

时间:2017-04-18 22:34:27      阅读:220      评论:0      收藏:0      [点我收藏+]


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  ]



本文出自 “福州恒达电脑” 博客,请务必保留此出处http://fzhddn.blog.51cto.com/12650899/1917110

linux 用NTP设定中国时间并同步

原文:http://fzhddn.blog.51cto.com/12650899/1917110

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!