서버시간이 로컬시간과 10분가량 차이가나서 통계 수집시 확인할 때마다 헷갈려서 시간 변경을 어떻게 해야하는지 알아보다가 찾은 정보입니다.
Below information is from here.
-----------------------------------------------------------------------------
Changing the timezone, date, and time
Setting your time zone
In
/etc the file,
localtime, is a link to or copy of a file containing information about your time zone. Zone information files are usually in
/usr/share/zoneinfo but this depends on your distribution. So if your
localtime file points to a zone info file that is not your time zone you can change it by browsing the directories in
/usr/share/zoneinfo to find your country, then find your city or a city in the same time zone and link
localtime to it.
$ ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
|
Some applications may use the configuration file
/etc/sysconfig/clock to determine the current time zone so it's a good idea to set the ZONE entry (e.g. "America/Los_Angeles").
Changing the date and time
Changing the date and time requires two steps. First, Linux's date
and time must be changed and then the new time has to be written to the
hardware clock.
The
date command can be used for both viewing and changing the date and time.
To change the time use
date followed by the month, day,
hour, minute, and year all numeric and no spaces. So, to set the date
and time to November 2nd, 2003 12:57
The hardware clock can be updated in UTC (coordinated universal
time) or your local time. It is standard practice to update it in UTC.
To update it to your local time leave off the
--utc or add
--localtime and leave off the
--utc.
Alternatively
The date and time can be changed directly to the hardware clock and then used to update the system clock.
Using NTP (Network Time Protocol)
NTP will connect to a server to get the atomic time. It can be downloaded from
www.ntp.org/downloads.html
To get started with NTP simply download it, install it, use the
ntpdate command followed by a public time server, and update your hardware clock.
$ ntpdate "server DNS name or IP address"
4 Nov 22:31:28 ntpdate[26157]: step time server 209.81.9.7 offset 22317290.440932 sec
$ hwclock --systohc
|
A public time server can be found at
http://support.ntp.org/bin/view/Servers/WebHome
To keep your time accurate you can create a cron job that executes:
(the -w option is the same as --systohc)
ntpdate "server name" && hwclock -w
|
To stay independent of a particiluar server you can use 0.pool.ntp.org
(0, 1, or 2) for the server name. This domain uses DNS round robin to
choose different time servers every so often. This keeps certain
nameservers from having high loads. The only disadvantage is the
increased potential of updating time from a nameserver who is in the
pool but has an incorrect time settings.
These are volunteer public servers so be
polite, do not
constantly access the public servers, use only public servers (not
private), and if you have multiple machines, set up a ntp server and
have your other machines retrieve the time from your local server. Check
http://www.eecis.udel.edu/~mills/ntp/servers.html for detailed rules.
출처 : http://www.hypexr.org/linux_date_time_help.php