Carey【胭脂扣】

Linux时间同步

  很多时候Linux时间有差别

查看现在系统时间

date 

要比我的xp电脑快15分钟

当然我可以使用date -s "2014-01-16 12:12:3"

然后clock -w 
这个命令强制把系统时间写入CMOS

当然也可以指定同步时间的服务器

ntpdate asia.pool.ntp.org

提示没有ntpdate这个命令 

yum -y install ntpdate

安装完成后在次运行

ntpdate asia.pool.ntp.org

然后现在查看系统时间

date 时间与xp一致了

在用clock -w进行写入

然后写入crontab

运行命令:

crontab -e

在里面添加一条 0 23 * * * ntpdate asia.pool.ntp.org >> /var/log/ntpdate.log  

这样每天的23点系统会去ntpdate.asia.pool.net.org时间服务器上同步一次时间

详细可参考文章:http://blog.163.com/herod_xiao/blog/static/8718839920086303105621/

posted @ 2014-01-16 16:17  胭脂筘  阅读(193)  评论(0编辑  收藏  举报