Ubuntu與時間同步的新方法是 systemd-timesyncd。
與時間同步的新方法是 systemd-timesyncd。ntpq -p
的替代品是什麼?
使用
ntp
,我可以執行ntpq -p
以查看時鐘精度的目前狀態。新服務是否有等價物systemd-timesyncd
?我查看了
timedatectl
命令,它為我提供了以下選項:$ timedatectl --help timedatectl [OPTIONS...] COMMAND ... Query or change system time and date settings. -h --help Show this help message --version Show package version --no-pager Do not pipe output into a pager --no-ask-password Do not prompt for password -H --host=[USER@]HOST Operate on remote host -M --machine=CONTAINER Operate on local container --adjust-system-clock Adjust system clock when changing local RTC mode Commands: status Show current time settings set-time TIME Set system time set-timezone ZONE Set system time zone list-timezones Show known time zones set-local-rtc BOOL Control whether RTC is in local time set-ntp BOOL Enable or disable network time synchronization
也許我可以查看某個文件?
我希望至少能看到一些這樣的數據:
$ sudo ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== monster .INIT. 16 u - 64 0 0.000 0.000 0.000 ntp.ucdavis.edu 128.9.176.30 2 u 4 64 1 19.383 -19.799 0.000 45.207.161.200 .INIT. 16 u - 64 0 0.000 0.000 0.000 time-b-wwv.nist .NIST. 1 u 3 64 1 46.721 2.287 0.000 198.255.68.106 172.89.18.234 2 u 3 64 1 29.467 0.775 0.000 euphoric.ca 128.233.154.245 2 u 3 64 1 55.963 2.732 0.000 user-69-1-1-251 216.239.35.0 2 u 3 64 1 106.202 11.649 0.000 tick.chi1.ntfo. 206.55.64.77 3 u 4 64 1 61.316 -3.556 0.000
目前版本
timedatectl
有兩個子命令,可用於顯示有關system-timesyncd
SNTP(簡單網路時間協議)客戶端服務的資訊。SNTP 客戶端比 NTP 客戶端更簡單、更簡約,因為它繞過了各個步驟,沒有保存太多同步資訊,只是定期調整系統時間,因此準確性較低。
ntpq
不適用於 SNTP。# timedatectl timesync-status -a Server: 162.159.200.1 (0.fedora.pool.ntp.org) Poll interval: 4min 16s (min: 32s; max 34min 8s) Leap: normal Version: 4 Stratum: 3 Reference: A230E10 Precision: 1us (-25) Root distance: 24.711ms (max: 5s) Offset: -609us Delay: 36.883ms Jitter: 211.500ms Packet count: 384 Frequency: +10.723ppm # timedatectl show-timesync -a LinkNTPServers= SystemNTPServers= FallbackNTPServers=0.fedora.pool.ntp.org 1.fedora.pool.ntp.org 2.fedora.pool.ntp.org 3.fedora.pool.ntp.org ServerName=0.fedora.pool.ntp.org ServerAddress=162.159.200.1 RootDistanceMaxUSec=5s PollIntervalMinUSec=32s PollIntervalMaxUSec=34min 8s PollIntervalUSec=4min 16s NTPMessage={ Leap=0, Version=4, Mode=4, Stratum=3, Precision=-25, RootDelay=48.660ms, RootDispersion=381us, Reference=A230E10, OriginateTimestamp=Thu 2021-02-18 04:47:25 GMT, ReceiveTimestamp=Thu 2021-02-18 04:47:25 GMT, TransmitTimestamp=Thu 2021-02-18 04:47:25 GMT, DestinationTimestamp=Thu 2021-02-18 04:47:26 GMT, Ignored=no PacketCount=384, Jitter=211.500ms } Frequency=702740 #
如果要持續監控
systemd-timesyncd
服務的狀態,可以使用timedatectl timesync-status --monitor
.
systemd-timesyncd
您可以使用--property=
or-p
選項顯示服務的各個屬性。例如:# timedatectl show-timesync -p ServerName ServerName=0.fedora.pool.ntp.org #