
Kontext:
Centos 7.0
chronyc (chrony) Version 3.1 (+READLINE +IPV6 +DEBUG)
Ausgabe
Ich möchteFinden Sie einen Weg, Chronyd zu zwingen, die Hardware-Uhr sofort zu ändernohne zu warten.
Das Programm chronyd
läuft derzeit auf meinem Rechner:
[root@localhost ~]# ps -ef | grep chronyd
chrony 599 1 0 21:59 ? 00:00:00 /usr/sbin/chronyd
root 6710 4779 0 22:31 pts/0 00:00:00 grep --color=auto chron
chronyd
ist in der Datei tatsächlich folgendermaßen konfiguriert /etc/chrony.conf
:
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift
# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3
# Enable kernel synchronization of the real-time clock (RTC).
rtcsync
# Enable hardware timestamping on all interfaces that support it.
hwtimestamp *
# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2
# Allow NTP client access from local network.
allow 192.168.0.0/16
# Ignore stratum in source selection.
stratumweight 0
# Specify directory for log files.
logdir /var/log/chrony
# Select which information is logged.
#log measurements statistics tracking
pool chronos.univ-brest.fr
Der NTP-Host, den die Maschine aktuell anfragt, ist chronos.univ-brest.fr
und die Maschine kann ihn anpingen:
[root@localhost ~]# ping chronos.univ-brest.fr
PING chronos.univ-brest.fr (195.83.247.18) 56(84) bytes of data.
64 bytes from chronos.univ-brest.fr (195.83.247.18): icmp_seq=1 ttl=239 time=38.3 ms
64 bytes from chronos.univ-brest.fr (195.83.247.18): icmp_seq=2 ttl=239 time=38.7 ms
Der einzige ähnliche Beitrag, den ich gefunden habe, löst mein Problem nichthttps://stackoverflow.com/questions/49730407/how-to-resynchronize-with-chrony
Das aktuelle Datum auf der Maschine ist folgendes:
[root@localhost ~]# date
jeu. févr. 2 22:40:21 CET 1978
Ich würde gerne eine Möglichkeit finden, chronyd
die Hardwareuhr sofort auf das vom NTP-Host angegebene Datum umzustellen.
Antwort1
Wenn chronyd nicht bereits läuft, könnte ein Befehl ähnlich „ntpdate pool.ntp.org“ lauten (seit Version 1.30):
chronyd -q 'server pool.ntp.org iburst'
Wenn es bereits ausgeführt wird und einige Server konfiguriert sind, wäre das Äquivalent:
chronyc -a 'burst 4/4'
Wenn Sie möchten, dass chronyd bei einem größeren Offset die Uhr auch schrittweise verstellt, anstatt sie zu verschieben, und chrony.conf keine unbegrenzte Makestep-Direktive enthält, müssen Sie ebenfalls warten, bis die neuen Messungen durchgeführt wurden, und chronyd dann anweisen, den Schritt auszuführen:
sleep 10
chronyc -a makestep