CentOS7/Red Hat7 NTP服务无法开机自启动问题解决
2017-12-15 17:25
519 查看
原文地址:http://blog.csdn.net/babyfish13/article/details/52502522
centos7不同于以往linux的操作,对于开机自启动的调整,命令有所不同。 chkconfig --list查看非系统内置服务的自启动状态
[html] view
plain copy
print?
[root@master ~]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
iprdump 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iprinit 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iprupdate 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
vmware-tools 0:off 1:off 2:on 3:on 4:on 5:on 6:off
根据提示,要查看系统内置的服务自启动状态需要使用命令systemctl list-unit-files,它会列出系统所有内置服务的自启动状态。
所以调整ntp的自启动需要在这里调整。
[html] view
plain copy
print?
[root@master ~]# systemctl enable ntpd.service //开机自启动
调整之后重启系统,可是发现ntp并没有启动起来
[root@master ~]# pgrep ntpd //无法查看到相关进程
[root@master ~]# systemctl status ntpd
ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
Active: inactive (dead) //显示开机自启动了,但是状态是inactive
通过查询发现有一个chronyd服务设置为开机自启动,这个服务导致ntp无法开启自启动
[html] view
plain copy
print?
[root@master ~]# systemctl status chronyd
chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled)
Active: inactive (dead) since Tue 2014-11-11 08:28:14 CST; 1min 45s ago
Main PID: 3033 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/chronyd.service
Nov 11 08:06:31 master.zj.chinamobile.com systemd[1]: Starting NTP clien...
Nov 11 08:06:31 master.zj.chinamobile.com chronyd[3033]: chronyd version...
Nov 11 08:06:31 master.zj.chinamobile.com chronyd[3033]: Linux kernel ma...
Nov 11 08:06:31 master.zj.chinamobile.com chronyd[3033]: hz=100 shift_hz...
Nov 11 08:06:31 master.zj.chinamobile.com systemd[1]: Started NTP client...
Nov 11 08:28:14 master.zj.chinamobile.com systemd[1]: Stopping NTP clien...
Nov 11 08:28:14 master.zj.chinamobile.com systemd[1]: Stopped NTP client...
Hint: Some lines were ellipsized, use -l to show in full.
通过禁止chronyd服务开机自启动之后再将系统重启
[html] view
plain copy
print?
[root@master ~]# systemctl disable chronyd.service
rm '/etc/systemd/system/multi-user.target.wants/chronyd.service'
[root@master ~]# pgrep ntpd
2981
[root@master ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
10.70.213.132 10.70.91.148 3 u 21 64 1 1.252 0.029 0.000
*10.70.213.133 10.70.91.148 3 u 21 64 1 1.139 -0.191 0.000
此时,NTP的服务已经开机自启动了,完成!
说白了,一句话,因为chronyd未被禁用,导致ntpq即使配置了也无法实现开机启动!
备注:
Chrony是一个开源的自由软件,它能保持系统时钟与时钟服务器(NTP)同步,让时间保持精确。是RHEL7中新的ntp对时服务。
centos7不同于以往linux的操作,对于开机自启动的调整,命令有所不同。 chkconfig --list查看非系统内置服务的自启动状态
[html] view
plain copy
print?
[root@master ~]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
iprdump 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iprinit 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iprupdate 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
vmware-tools 0:off 1:off 2:on 3:on 4:on 5:on 6:off
根据提示,要查看系统内置的服务自启动状态需要使用命令systemctl list-unit-files,它会列出系统所有内置服务的自启动状态。
所以调整ntp的自启动需要在这里调整。
[html] view
plain copy
print?
[root@master ~]# systemctl enable ntpd.service //开机自启动
调整之后重启系统,可是发现ntp并没有启动起来
[root@master ~]# pgrep ntpd //无法查看到相关进程
[root@master ~]# systemctl status ntpd
ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled)
Active: inactive (dead) //显示开机自启动了,但是状态是inactive
通过查询发现有一个chronyd服务设置为开机自启动,这个服务导致ntp无法开启自启动
[html] view
plain copy
print?
[root@master ~]# systemctl status chronyd
chronyd.service - NTP client/server
Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled)
Active: inactive (dead) since Tue 2014-11-11 08:28:14 CST; 1min 45s ago
Main PID: 3033 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/chronyd.service
Nov 11 08:06:31 master.zj.chinamobile.com systemd[1]: Starting NTP clien...
Nov 11 08:06:31 master.zj.chinamobile.com chronyd[3033]: chronyd version...
Nov 11 08:06:31 master.zj.chinamobile.com chronyd[3033]: Linux kernel ma...
Nov 11 08:06:31 master.zj.chinamobile.com chronyd[3033]: hz=100 shift_hz...
Nov 11 08:06:31 master.zj.chinamobile.com systemd[1]: Started NTP client...
Nov 11 08:28:14 master.zj.chinamobile.com systemd[1]: Stopping NTP clien...
Nov 11 08:28:14 master.zj.chinamobile.com systemd[1]: Stopped NTP client...
Hint: Some lines were ellipsized, use -l to show in full.
通过禁止chronyd服务开机自启动之后再将系统重启
[html] view
plain copy
print?
[root@master ~]# systemctl disable chronyd.service
rm '/etc/systemd/system/multi-user.target.wants/chronyd.service'
[root@master ~]# pgrep ntpd
2981
[root@master ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
10.70.213.132 10.70.91.148 3 u 21 64 1 1.252 0.029 0.000
*10.70.213.133 10.70.91.148 3 u 21 64 1 1.139 -0.191 0.000
此时,NTP的服务已经开机自启动了,完成!
说白了,一句话,因为chronyd未被禁用,导致ntpq即使配置了也无法实现开机启动!
备注:
Chrony是一个开源的自由软件,它能保持系统时钟与时钟服务器(NTP)同步,让时间保持精确。是RHEL7中新的ntp对时服务。
相关文章推荐
- CentOS7/Red Hat7 NTP服务无法开机自启动问题解决
- CentOS7/Red Hat7 NTP服务无法开机自启动
- 开机登录失败 提示"user profile service服务未能登录,无法加载用户配置文件" 问题解决办法
- 解决Win7系统DHCP Client服务已设置为“自动”开机仍然无法启动问题
- 计算机服务项里没有MySQL服务,无法设置开机自启动或者关闭自启动,的解决办法
- Apache本地服务无法自启动问题解决
- 解决Windows安装解压版MySQL出现服务正在启动-服务无法启动的问题
- SVN卸载,修复,等问题:依赖服务或组无法启动.(0x8007042c)解决之一
- keepalive自启动服务报错,问题的解决
- 关于SQL Server 2005服务无法启动,报3417错误。(附带重装SQL时解决COM+目录问题)(转帖)
- ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 问题解决
- 解决Windows安装解压版MySQL出现服务正在启动-服务无法启动的问题
- 关于SQL Server 2005服务无法启动,报3417错误。(附带重装SQL时解决COM+目录问题)(转帖)
- 关于Linux 下多网卡开机自启动问题解决
- .Net下使用System.Data.OracleClient出现“ORA-12154问题“TNS: 无法处理服务名”问题的解决
- 解决在CentOS6.5下安装OpenStack(Icehouse版本 )出现的glance服务无法正常工作的问题
- ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务 问题解决
- 域网共享需要开启的服务项,解决局域网无法共享问题!
- 解决 Ubuntu 14.04 无法调节屏幕亮度以及开机后保持上一次亮度的问题
- 关于Windows installer 服务无法访问 等一些问题解决亲体验