systemd怎么查看开机自启动服务

文章目录

在CentOS 7及更高的版本中,使用chkconfig命令查看开机自启动信息时,发现只有几个服务被SysV管理的服务,没有包括systemd管理的服务。

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@kvm-hkcloud01 var]# 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]'.

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
[root@kvm-hkcloud01 var]#

如果需要查看被systemd管理的服务,可以使用以下命令进行查询。

1
[root@kvm-hkcloud01 var]# systemctl list-unit-files

更多systemd内容,可参考https://ruanyifeng.com/blog/2016/03/systemd-tutorial-commands.html