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 ユーティリティがありません

-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サーバーは次のいずれかを指します。正しい時刻を取得するには、metadata.google または metadata.google.internal を使用します。NTPを無効にした後は、

sudo date

答え3

サービスを一時停止するために書き込みます。

service ntpd stop

永久停止の場合:

service ntpd disable

よろしく

関連情報