Time Setting In ubuntu (hardware time, system time, local time), ubuntu hardware

Source: Internet
Author: User

Time Setting In ubuntu (hardware time, system time, local time), ubuntu hardware

The cause of the problem is:

In cron, the task is set to be executed at a.m.. When checking logs, it is found that the time is always incorrect. It is executed at around a.m. The study found that the task was executed at local time, but I do not know why the time in syslog is utc time.

Here, the concepts of hardware time, system time, and local time are involved. The following are some command operations involved:

 

How to set the time zone:

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

1. sudo tzselect

Ii. copy the file to sudo cp/usr/share/zoneinfo/Asia/Shanghai/etc/localtime In The/etc directory. III. Update Time: sudo ntpdate time.windows.com check time:

Pwsync @ wepingwest:/etc/default $ date

Thu Apr 2 12:26:33 CST 2015

Pwsync @ wepingwest:/etc/default $ date-u

Thu Apr 2 04:26:55 UTC 2015

Pwsync @ wepingwest:/etc/default $ date-R

Thu, 02 Apr 2015 12:27:16 + 0800

Hardware time:

Pwsync @ wepingwest:/etc/default $ sudo hwclock -- show

Thu 02 Apr 2015 12:27:42 pm cst-0.317712 seconds

The hardware time is also localtime.

Finally, in order to display the local time in syslog and other logs, You Need To Set utc to no in/etc/default/rcS (the system needs to be restarted)

 

To save the system time on hardware

# Hwclock -- systohc

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

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

 

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.