[root@ClockworkMonkey ~]# yum install ntpdate Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile Package ntpdate-4.2.6p5-29.el7.centos.2.x86_64 already installed and latest version Nothing to do
同步时间
1 2 3 4 5 6 7
root@localhost [10:27:41 AM] [~] -> # ntpdate cn.pool.ntp.org 29 Apr 10:27:55 ntpdate[62380]: adjust time server 124.108.20.1 offset -0.000588 sec root@localhost [10:27:55 AM] [~] -> # ntpdate -u cn.pool.ntp.org 29 Apr 10:28:08 ntpdate[62383]: adjust time server 119.28.206.193 offset 0.002792 sec
root@localhost [10:28:08 AM] [~] -> # systemctl status ntpdate ● ntpdate.service - Set time via NTP Loaded: loaded (/usr/lib/systemd/system/ntpdate.service; disabled; vendor preset: disabled) Active: inactive (dead) root@localhost [10:31:08 AM] [~] -> # systemctl start ntpdate root@localhost [10:31:28 AM] [~] -> # systemctl status ntpdate ● ntpdate.service - Set time via NTP Loaded: loaded (/usr/lib/systemd/system/ntpdate.service; disabled; vendor preset: disabled) Active: active (exited) since Thu 2021-04-29 10:31:28 CST; 2s ago Process: 62427 ExecStart=/usr/libexec/ntpdate-wrapper (code=exited, status=0/SUCCESS) Main PID: 62427 (code=exited, status=0/SUCCESS)
Apr 29 10:31:23 localhost.localdomain systemd[1]: Starting Set time... Apr 29 10:31:28 localhost.localdomain systemd[1]: Started Set time ... Hint: Some lines were ellipsized, use -l to show in full.
root@localhost [10:31:43 AM] [~] -> # systemctl enable ntpdate Created symlink from /etc/systemd/system/multi-user.target.wants/ntpdate.service to /usr/lib/systemd/system/ntpdate.service. root@localhost [10:31:58 AM] [~] -> # systemctl status ntpdate ● ntpdate.service - Set time via NTP Loaded: loaded (/usr/lib/systemd/system/ntpdate.service; enabled; vendor preset: disabled) Active: active (exited) since Thu 2021-04-29 10:31:28 CST; 41s ago Main PID: 62427 (code=exited, status=0/SUCCESS)
Apr 29 10:31:23 localhost.localdomain systemd[1]: Starting Set time... Apr 29 10:31:28 localhost.localdomain systemd[1]: Started Set time ... Hint: Some lines were ellipsized, use -l to show in full.
[root@nginx02 ~]# ntpdate cn.pool.ntp.org 1 Apr 11:06:48 ntpdate[1516]: step time server 84.16.67.12 offset -28798.752783 sec [root@nginx02 ~]# systemctl status ntpdate ● ntpdate.service - Set time via NTP Loaded: loaded (/usr/lib/systemd/system/ntpdate.service; disabled; vendor preset: disabled) Active: inactive (dead) [root@nginx02 ~]# systemctl start ntpdate [root@nginx02 ~]# systemctl status ntpdate ● ntpdate.service - Set time via NTP Loaded: loaded (/usr/lib/systemd/system/ntpdate.service; disabled; vendor preset: disabled) Active: active (exited) since Fri 2022-04-01 11:07:20 CST; 1s ago Process: 1524 ExecStart=/usr/libexec/ntpdate-wrapper (code=exited, status=0/SUCCESS) Main PID: 1524 (code=exited, status=0/SUCCESS)
Apr 01 11:07:17 nginx02.centos.gg systemd[1]: Starting Set time via NTP... Apr 01 11:07:20 nginx02.centos.gg systemd[1]: Started Set time via NTP. [root@nginx02 ~]# systemctl enable ntpdate Created symlink from /etc/systemd/system/multi-user.target.wants/ntpdate.service to /usr/lib/systemd/system/ntpdate.service.