CentOS 6 and modification time and modification time zone and time synchronization is provided

First, the time zone

date -R; date ; hwclock --show ; ps -ef|grep ntpd

The time zone

date --help to get help

date -R

date +%z

These two commands are available

 date -R; date +%z  

 

Mainly behind +0800 East eight districts

 

Change the time zone

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

Presence information time zone / usr / share / zoneinfo / below, time zone information is present in the machine / etc / localtime

 

Second, the time

The concept: Linux has two time

System Time: software, also known as time (sys), 1970 Nian 1 January 1 to the current second time

BOIS time: also called hardware time (hc)

 

display time

date;hwclock -r  

October 19, 2012 Friday 23:39:44 CST  

October 19, 2012 Friday 23:39:45 -0.317993 seconds  

 

Setting time

date -s 20121019  

date -s 23:40:00  

Under no circumstances can use this network

  

2、ntpdate

ntpdate time.windows.com && hwclock -w  

Internet update, if successful, the system time, write BOIS

# Synchronize system time to hardware time

hwclock -w or hwclock --systohc [sys system time, tohc hardware time]

# Hardware time synchronized to the system time

clock -hctosys or hwclock --hctosys [hc represent hardware time, sys represents the system time]

You can do the crontab

 

3, start the ntpd service, it can not be used after the open.

Ntpdate first with updates to make sure that time will not differ too much

rpm -qa | grep ntp # check what can be installed

chkconfig --list | grep ntp # facie case of service

chkconifg ntpd on

service ntpd start 或/etc/init.d/ntpd start

If necessary, set about /etc/ntp.conf, then service reload it.

 

Guess you like

Origin www.cnblogs.com/eos666/p/11105048.html