How to modify the time zone in Linux without restarting

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.