There is an ntp package in Linux that can automatically calibrate the time, and it is very easy to use.
Debian system installation NTP time adjustment package:
apt-get install ntpdate
CentOS system installation NTP time adjustment package:
yum install ntp
Time adjustment command:
ntpdate cn.pool.ntp.org
If you want to To automatically adjust the time after a certain period of time, just add the above command to Cron:
00 12 * * * /sbin/ntpdate cn.pool.ntp.org
* cn.pool.ntp.org is the Chinese timing source of the ntp network timing organization
Quickly proofread the Linux server time to Beijing time
The server uses ntp to update the time, which often involves the issue of whether UTC is turned on. If it is turned on, the time will be 8 hours faster
Some time ago A friend gave me the following command, which solves all the previous problems with one command.
rdate -t 60 -s stdtime.gov.hk
Use rdate to capture the time of the stdtime.gov.hk server, and then write it to the hardware
hwclock -w
The following is an introduction to how to use the rdate command
Function description: Display the date and time of other hosts.
Syntax: rdate [-ps][Host name or IP address...]
Supplementary instructions: Execute the rdate command to ask other hosts for the system time and display it.
Parameters:
-p Display the date and time of the remote host.
-s Save the date and time received from the remote host back to the system time of the local host.
The above is the detailed content of What is the command to verify the time on a Linux server?. For more information, please follow other related articles on the PHP Chinese website!