centos7 查看启动ntp服务命令

标签(空格分隔): centos7 系统


1. 查看ntp服务命令:

[root@node1 ~]# systemctl status ntpd
* ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

可以看到状态为:inactive,也就是没有启动ntp服务

2. 启动ntp服务命令:

[root@node1 ~]# systemctl start ntpd

确认是否启动:

[root@node1 ~]# systemctl status ntpd
* ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
   Active: active (running) since 一 2017-10-16 17:12:05 CST; 2s ago
  Process: 8925 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 8926 (ntpd)
   CGroup: /system.slice/ntpd.service
           `-8926 /usr/sbin/ntpd -u ntp:ntp -g

10月 16 17:12:05 node1 ntpd[8926]: ntp_io: estimated max descriptors: 1024,...16
10月 16 17:12:05 node1 ntpd[8926]: Listen and drop on 0 v4wildcard 0.0.0.0 ...23
10月 16 17:12:05 node1 ntpd[8926]: Listen and drop on 1 v6wildcard :: UDP 123
10月 16 17:12:05 node1 ntpd[8926]: Listen normally on 2 lo 127.0.0.1 UDP 123
10月 16 17:12:05 node1 ntpd[8926]: Listen normally on 3 ens33 192.168.197.1...23
10月 16 17:12:05 node1 ntpd[8926]: Listen normally on 4 lo ::1 UDP 123
10月 16 17:12:05 node1 ntpd[8926]: Listen normally on 5 ens33 fe80::522e:70...23
10月 16 17:12:05 node1 ntpd[8926]: Listening on routing socket on fd #22 fo...es
10月 16 17:12:05 node1 ntpd[8926]: 0.0.0.0 c016 06 restart
10月 16 17:12:05 node1 ntpd[8926]: 0.0.0.0 c012 02 freq_set kernel 14.727 PPM
Hint: Some lines were ellipsized, use -l to show in full.

可以看到此时ntp状态为active,也就是成功启动了ntp服务

3. 设置开启自启动ntp服务:

[root@node1 ~]# systemctl enable ntpd

原文地址:https://www.cnblogs.com/sisimi/p/7698452.html