linux ntp time synchronization

ntpdate 1.cn.pool.ntp.org

http://blog.csdn.net/achang21/article/details/46693545

ntpdate time synchronization under Linux
Ntp server installation and configuration
RedHat server can download the rpm installation package, and then execute
# rpm -ivh ntp-4.2.0.a.20040617-4.x86_64.rpm or # yum -y install ntp.x86_64
Time synchronization method
Synchronization command
# ntpdate ntp server domain name or IP
For example: # ntpdate 1.cn.pool.ntp.org
http ://www.pool.ntp.org is the official website of NTP, on which we can find the NTP Server cn.pool.ntp.org from our country. It has 3 server addresses:
Server 1: 1.cn. pool.ntp.org
server 2: 2.asia.pool.ntp.org
server 3: 3.asia.pool.ntp.org
(Sometimes there is a problem with using the domain name directly, you can ping their IP first, and then use the IP address to synchronize )
Automatically run the synchronization time script setting
# crontab -e The
example of adding a script is as follows:
*/20 * * * * /usr/sbin/ntpdate 210.72.145.44 //execute every 20 minutes
30 5 * * * /usr/sbin/ntpdate 210.72.145.44 //execute every morning at 5:30
* The first five * The number represents five numbers. The value range and meaning of the numbers are as follows:
Minute (0-59) Hour (0-23) Date (1-31) Month (1-12) Week (0-6) //0 represents Sunday
After setting, you can use # crontab -l to view the above settings.
Question: When using time synchronization on a virtual machine (vmware server), although automatic synchronization is set, sometimes the time is still inaccurate. I don't understand the specific reasons, because sometimes it is easy to use, sometimes it is not easy to use , I haven't been staring at it for research~~~ I have the opportunity to study it again~
Manual modification of Linux system time and date
View current time # date
modification time command # date –s 12:12:00
modification date command # date –s 01/ 12/2008
Linux system time zone modification
View current time zone # vi /etc/sysconfig/clock
Modify time zone command # tzselect or # timeconfig
If you know the time zone name, you can also use the command directly, such as: # TZ='Asia/Shanghai'; export TZ // Change to +8 China Shanghai time zone
Or use a new time zone file to overwrite the system default time zone (the most effective test)
Example# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime //Asia Shanghai time zone replaces the system time zone
Synchronize the BIOS clock and force the system time to be written CMOS to make it take effect permanently, to avoid restoring to the original time after the system restarts.
# clock -w
View BIOS time command: # hwclock -r

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326175246&siteId=291194637