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)