您的位置:首页 > 运维架构 > Linux

linux 时间自动同步

2013-02-22 17:26 309 查看


linux系统修改时区,时间自动同步

博客分类: 

Linux

1、调整时区

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

linux提供是依据/etc/localtime文件内容知道目前系统的时区信息,这个文件一般是从/usr/share/zone/里面选择适当的时区复制过来就可以使用

2、手动调整时间(需要ntpdate)

    ntpdate us.pool.ntp.org

没有安装ntpdate可以

    yum install -y ntpdate

3、加入定时计划任务,每天进行同步一次:

   在’/etc/cron.daily’ 目录中建立一个脚本’ntpupdate’,內容如下表所示:

#! /bin/bash

/usr/sbin/ntpdate -s us.pool.ntp.org

/usr/sbin/hwclock --systohc
另用下列指令设定脚本可执行:

# chmod +x /etc/cron.daily/ntpupdate
<!--EndFragment-->

中国国家授时中心:
http://www.time.ac.cn/stime.asp
其他网络时间服务器地址如下

time.nist.gov(美国)

ntp.fudan.edu.cn(复旦)(国内用户推荐使用此服务器)

timekeeper.isi.edu

subitaneous.cpsc.ucalgary.ca

usno.pa-x.dec.com

time.twc.weather.com

swisstime.ethz.ch

ntp0.fau.de

ntp3.fau.de

time-a.nist.gov

time-b.nist.gov

time-nw.nist.gov

nist1-sj.glassey.com
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  LINUX