Linux Administration Cookbook
上QQ阅读APP看书,第一时间看更新

Checking if NTP is running

First, a basic check is to confirm the date is what you expect it to be, with the date command:

$ date
Mon 13 Aug 10:05:31 UTC 2018
Note that the preceding date information is set to universal time coordinated ( UTC). This is increasingly being used as distributed computing takes hold. Servers don't have to be locked to one geographical region, and if you've got a thousand boxes over multiple geographical locations, you might choose to unify their time and manage specific differences in other software instead (such as a web app being responsible for writing the timestamp for the location its user is located at, for example).

To check whether chronyd itself is running, use systemctl:

$ systemctl status chronyd
● chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2018-08-13 07:20:48 UTC; 2h 43min ago
Docs: man:chronyd(8)
man:chrony.conf(5)
Process: 576 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS)
Process: 556 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 570 (chronyd)
CGroup: /system.slice/chronyd.service
└─570 /usr/sbin/chronyd