The default installed time zone for VPS I purchased is Moscow (East quad)? And look at the execution of several commands:
root@blogguy_cn:~# Date
Wed 8 20:16:23 MSK 2014
root@blogguy_cn:~# Date-u
Wed 8 16:16:26 UTC 2014
root@blogguy_cn:~# Date-r
Wed 2014 20:18:39 +0400
See it! Time zone is MSK, 4 hours later than GMT. This is not the main problem that we often encounter. The problem is the following:
I want to perform the following crontab:
0 0 * * * root/var/www/cron_book.sh >>/var/www/crontab_book.log 2 >&1
Guess what time the task will be executed?
My intention is to do it at 12 o'clock midnight, and the result? Check the log:
2014-01-08 04:00:08 Start
It's a little confusing. I tried to change the time to UTC with no effect.
The time zone can only be changed to the UTC unified London time zone/etc/localtime file
Ln-sf/usr/share/zoneinfo/europe/london/etc/localtime
The same show modifies the/etc/timezone file, the original file is:
Etc/utc
Europe/moscow
Modified to:
Etc/utc
Europe/london
And then run:
root@111cn.net:~# Date
Wed 8 16:25:24 GMT 2014
root@111cn.net:~# Date-u
Wed 8 16:25:28 UTC 2014
root@111cn.net:~# Date-r
Wed 2014 16:25:37 +0000
Summary reason:
Within the Linux system, the system time is determined by hardware time, UTC (/ETC/DEFAULT/RCS), timezone three factors. Where the UTC option in/etc/default/rcs tells the Linux system whether this hardware time is UTC, TimeZone is the UTC time zone where the system is set (we are usually set to Asia/shanghai). When the system starts, it reads the hardware time and calculates the system localtime based on the UTC time and the timezone of the system. Debian defaults to the world Time (UTC) as the BIOS time, so the system time is 8 hours faster than it actually is.