日期:2014-05-16  浏览次数:20533 次

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

?