Google Cloud Container-Optimized OS에서 날짜를 어떻게 변경하나요?

Google Cloud Container-Optimized OS에서 날짜를 어떻게 변경하나요?

날짜를 설정하려고 합니다.

sudo date -s "28 OCT 2018 15:00:00"

하지만 NTP를 비활성화해야 하기 전에

timedatectl set-ntp false

Google Cloud Container-Optimized OS에는 timedatectl util이 없습니다.

-bash: timedatectl: command not found

하지만 어떤 유틸리티가 내 설정 시간을 ntp 시간으로 반환합니까? Google Cloud Container-Optimized OS에서 SSH를 통해 다른 날짜를 설정하는 방법은 무엇입니까? 도와주세요!

답변1

Container-Optimized OS의 기본 시간대는 UTC0입니다. 다음 예와 같이 원하는 시간대에 대한 심볼릭 링크를 만듭니다. 공식 문서를 확인하세요.시간대 변경

sudo rm /etc/localtime
sudo ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime

답변2

다음을 사용하여 NTP를 비활성화할 수 있습니다.

sudo systemctl stop ntp 
sudo systemctl disable ntp

예상 출력:

ntp.service is not a native service, redirecting to systemd-sysv-install Executing /lib/systemd/systemd-sysv-install disable ntp

확인하다:

systemctl is-enabled ntp

예상 출력:

ntp.service is not a native service, redirecting to systemd-sysv-install Executing /lib/systemd/systemd-sysv-install is-enabled ntp disabled

기본적으로 NTP 서버는 다음 중 하나를 가리킵니다.정확한 시간을 얻으려면 메타데이터.google 또는 메타데이터.google.internal. NTP를 비활성화한 후 다음을 사용하여 날짜나 시간을 변경할 수 있습니다.

sudo date

답변3

잠시 서비스를 중단하라고 써주세요.

service ntpd stop

영구 정지의 경우:

service ntpd disable

문안 인사

관련 정보