chkconfig-配置系统服务

管理Linux系统开机启动项。
chkconfig命令默认在CentOS7+中不被使用了,由于系统服务管理都交给了systemctl托管。

语法

chkconfig [--list] [--type <type>] [name]
chkconfig --add <name>
chkconfig --del <name>
chkconfig --override <name>
chkconfig [--level <levels>] [--type <type>] <name> <on|off|reset|resetpriorities>

选项

--add             增加所指定的系统服务
--del             删除所指定的系统服务
--level <level>   指定系统服务要在哪一个执行等级中开启或关毕

支持的系统级别

0 关机
1 单用户模式
2 无网络支持的多用户模式
3 有网络支持的多用户模式
4 保留,未使用
5 有网络支持有X-Window支持的多用户模式
6 重新引导系统,即重启

示例

列出可管理的系统服务列表:

[root@localhost ~]# chkconfig --list
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

添加删除系统服务:
服务启动脚本需要存放在/etc/init.d目录下面。

[root@localhost ~]# chkconfig --add httpd
[root@localhost ~]# chkconfig --del httpd

设置指定的服务在系统级别开机自启动:

[root@localhost ~]# chkconfig --level 35 httpd on
posted @ 2021-11-05 15:46  RidingWind  阅读(151)  评论(0)    收藏  举报