介绍:
通过 ​​chkconfig​​ 命令可以给服务的各个运行级别设置自 ​启动/关闭Linux之chkconfig命令基本使用_Linux之chkconfig



​chkconfig​​ 指令管理的服务在 ​​/etc/init.d​​ 查看
Linux之chkconfig命令基本使用_chkconfig命令_02



注意: ​​Centos7.0​​ 后,很多服务使用 ​​systemctl​​ 管理



​chkconfig​​ 基本语法
Linux之chkconfig命令基本使用_chkconfig命令基本使用_03





查看服务 ​​chkconfig --list [| grep xxx]​Linux之chkconfig命令基本使用_chkconfig命令_04
Linux之chkconfig命令基本使用_chkconfig命令_05



​chkconfig 服务名 --list​Linux之chkconfig命令基本使用_chkconfig命令_06



​chkconfig --level 5 服务名 on/off​



  • 案例演示 : 对 ​​network​​​ 服务 进行各种操作, 把 ​​network​​​ 在 ​​3​​ 运行级别,关闭自启动
chkconfig --level 3 network off  // 关闭
chkconfig --level 3 network on // 开启

Linux之chkconfig命令基本使用_linux_07

  • 使用细节
    ​​​chkconfig​​​ 重新设置服务后自启动或关闭,需要重启机器 ​​reboot​​ 生效.