在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