Article Title: how to modify the time zone in Linux without restarting. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
The installed virtual machine did not pay too much attention to the time zone. It was found that the time zone was 16 hours slower than that in Shanghai, China. I found the following method on the Internet and shared it with you:
---------------------------------
The Time Zone configuration file is/etc/sysconfig/clock. You can use the tzselect command to modify the configuration file.
However, in actual work, it is found that this method cannot make the time settings on the server take effect immediately, and ntpdate cannot be used to synchronize the time on the server. Even if you use the date command to manually set the time, if you use ntpdate for time synchronization, the time will be changed to the time in the original wrong time zone. Production machines are often very important and cannot be restarted.
If you want to modify the time zone and it will take effect immediately, you can change the/etc/localtime file. For example, if you change the time zone to Shanghai, you can use the following command to make the change take effect.
Cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime
Then it is best to use the following command to write the changes to the bios.
Hwclock
--------------------------------
Specific operations:
[Root @ localhost ~] # Cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime
Cp: overwrite '/etc/localtime '? Y
[Root @ localhost ~] # Date
Sat Feb 20 16:04:43 CST 2010
[Root @ localhost ~] # Hwclock
Sat 20 Feb 2010 04:05:12 pm cst-0.474966 seconds