2017年6月18日 星期日

Linux Timezone settings

由於業務需求,服務器會內在不同的地區,先在這裡簡單介紹更改時區的問題。
日後會補充美國夏令及冬令時區轉換的問題。



CentOS 7

$ date

$ ls -l /etc/localtime

# timedatectl list-timezones

##*** Grep possible Asian timezones ***##
# timedatectl list-timezones | grep Asia


The syntax is as follows to set timezone and need to run as root user:
# timedatectl set-timezone time_zone
In this example, set timezone to America/Chicago
# timedatectl set-timezone America/Chicago
Change the current timezone in CentOS 6 and older
Type the following commands as root:
cp /etc/localtime /root/old.timezone
rm /etc/localtime
ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
Verify new settings by typing the following two commands:
date
ls -l /etc/localtime


Ref :
https://www.cyberciti.biz/faq/centos-linux-6-7-changing-timezone-command-line/

沒有留言:

張貼留言