클라우드 네이티브 애플리케이션 부트캠프 알림

티스토리 뷰

timedatectl 사용법에 대해 설명합니다.

timezone 변경하기

timedatectl list-timezones로 timezone이름을 찾고,
timedatectl set-timezone명령으로 timezone을 변경합니다.

[root@bastion ~]# timedatectl
      Local time: Mon 2020-06-08 02:08:54 CDT
  Universal time: Mon 2020-06-08 07:08:54 UTC
        RTC time: Mon 2020-06-08 07:08:54
       Time zone: America/Chicago (CDT, -0500)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2020-03-08 01:59:59 CST
                  Sun 2020-03-08 03:00:00 CDT
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2020-11-01 01:59:59 CDT
                  Sun 2020-11-01 01:00:00 CST
[root@bastion ~]# timedatectl list-timezones | grep Seoul
Asia/Seoul
[root@bastion ~]# timedatectl set-timezone Asia/Seoul
[root@bastion ~]# timedatectl
      Local time: Mon 2020-06-08 16:10:28 KST
  Universal time: Mon 2020-06-08 07:10:28 UTC
        RTC time: Mon 2020-06-08 07:10:28
       Time zone: Asia/Seoul (KST, +0900)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a

아래와 같이 timezone에 맞게 시간이 나옵니다.  
[root@bastion ~]# journalctl -f
-- Logs begin at Wed 2020-06-03 14:00:06 KST. --
Jun 08 16:12:55 bastion.ibm.cloud sshd[3189]: pam_succeed_if(sshd:auth): requirement "uid >= 1000" not met by user "root"
Jun 08 16:12:57 bastion.ibm.cloud sshd[3189]: Failed password for root from 37.49.226.181 port 47724 ssh2
Jun 08 16:12:57 bastion.ibm.cloud sshd[3189]: Re

시간 변경하기 : set-time, set-ntp

ntp는 Network Time Protocol의 약자로 자동으로 시간을 맞춰주는 서비스입니다.

[root@bastion ~]# timedatectl
      Local time: Mon 2020-06-08 16:15:20 KST
  Universal time: Mon 2020-06-08 07:15:20 UTC
        RTC time: Mon 2020-06-08 07:15:20
       Time zone: Asia/Seoul (KST, +0900)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
[root@bastion ~]# timedatectl set-time 11:00:00
Failed to set time: Automatic time synchronization is enabled
[root@bastion ~]# timedatectl set-ntp false
timedatectl set-ntp false
[root@bastion ~]# timedatectl
timedatectl
      Local time: Mon 2020-06-08 16:15:49 KST
  Universal time: Mon 2020-06-08 07:15:49 UTC
        RTC time: Mon 2020-06-08 07:15:49
       Time zone: Asia/Seoul (KST, +0900)
     NTP enabled: no
NTP synchronized: yes
 RTC in local TZ: no
      DST active: n/a
[root@bastion ~]# timedatectl set-time 11:00:00
[root@bastion ~]# timedatectl
      Local time: Mon 2020-06-08 11:00:08 KST
  Universal time: Mon 2020-06-08 02:00:08 UTC
        RTC time: Mon 2020-06-08 02:00:08
       Time zone: Asia/Seoul (KST, +0900)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
댓글

클라우드 네이티브 애플리케이션 부트캠프 알림