Time settings under Ubuntu (Hardware time, system time, local time)

Source: Internet
Author: User
Tags local time syslog

The reason for the problem is here:

In Cron, the task is performed at 6 o'clock in the morning, and when the log is checked, the time is always wrong and is performed at about 22 O ' notice. The study found that the task was performed at 6 points in local time, but somehow the time in the Syslog was the UTC time.

Here are some concepts related to hardware time, system time, local time, and the following are some command operations:

Basic methods for setting the time zone:

Http://blog.sina.com.cn/s/blog_6c9d65a1010145st.html

1. Sudo tzselect

Second, copy files to/etc directory sudo cp/usr/share/zoneinfo/asia/shanghai/etc/localtime Three, update time sudo ntpdate time.windows.com check time:

[Email protected]:/etc/default$ Date

Thu APR 2 12:26:33 CST 2015

[Email protected]:/etc/default$ date-u

Thu APR 2 04:26:55 UTC 2015

[Email protected]:/etc/default$ date-r

Thu, April 2015 12:27:16 +0800

Hardware time:

[Email protected]:/etc/default$ sudo hwclock--show

Thu 12:27:42 PM CST-0.317712 seconds

This ensures that the hardware time is also localtime.

Finally, in order to display local time in logs such as syslog, you need to set UTC to No in/etc/default/rcs. (Need to restart the system)

To keep the system's time on the hardware, you need to

# Hwclock--SYSTOHC

(http://blog.chinaunix.net/uid-26495963-id-3048079.html)

(http://www.111cn.net/sys/linux/58514.htm)

Time settings under Ubuntu (Hardware time, system time, local time)

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.