在Linux6中查看及設置開機自啟信息是使用
chkconfig
命令,Linux7中此命令已經被替代,接下來我們就來研究下Linux7中的區別所在。
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
vmware-tools 0:off 1:off 2:on 3:on 4:on 5:on 6:off
首先我們可以發現,雖然Linux7中已經不再使用
chkconfig
命令來管理服務是否開機自啟,但是此命令仍舊可用,但是輸出信息提示我們使用chkconfig
命令的輸出只是唄SysV
所管理的服務,不包括systemd
管理的服務,如果想在CentOS7中查看systemd
管理的服務需要使用以下命令:
systemctl list-unit-files
- 查看
systemd
開機自啟服務
systemctl list-unit-files |grep enabled
- 設置某服務開機自啟
systemctl enable smb nmb
- 關閉某服務開機自啟
systemctl disable smb nmb