寻觅生命中的那一片浅草......

Linux调整系统时间和时区的方法、同步时间的方法

1) 找到相应的时区文件 /usr/share/zoneinfo/Asia/Shanghai

用这个文件替换当前的/etc/localtime文件。

2) 修改/etc/sysconfig/clock文件,修改为:

ZONE=”Asia/Shanghai”

UTC=false

ARC=false

3) 用修改系统时间为2004年6月4日10点45分,命令如下:

date 060410452004

4) 同步BIOS时钟,命令如下:

hwclock -w

5) 自动同步系统时间:

/usr/bin/rdate -s time-a.nist.gov

clock -w

使用NTP服务器更新本地时间

ntpdate time-a.nist.gov

常用的NTP服务器

cn.pool.ntp.org

time-a.nist.gov

time.windows.com

chime.utoronto.ca

ntp.pipex.net

最好加个计划任务让它自动同步

crontab -e

添加以下内容,每天凌晨零点进行同步

00 00 * * * /usr/sbin/ntpdate cn.pool.ntp.org

保存退出

参考文章:http://hi.baidu.com/start_and_end/blog/item/1f85184617c04d0c6a63e550.html

尚无评论

发表评论

2024年四月
« 5月    
1234567
891011121314
15161718192021
22232425262728
2930