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

转载自http://www.114time.com/info/270.html


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

 



另用下列指令�O定此�_本�榭�绦校�


# chmod +x /etc/cron.daily/ntpupdate


中国国家北京时间授时中心:

http://www.time.ac.cn/stime.asp




你可能感兴趣的:(linux,中国,share,北京时间,Shanghai)