在 SysV init 體系下,chkconfig 是管理服務開機自啟與執行等級的標準工具。以下整理它的參數與等級含義。
[root@ndnp /]# chkconfig --help chkconfig version 1.3.49.3 - Copyright (C) 1997-2000 Red Hat, Inc. usage: chkconfig [--list] [--type <type>] [name] chkconfig --add <name> 增加系統服務 chkconfig --del <name> 刪除服務 chkconfig --override <name> 覆寫服務設定 chkconfig [--level <levels>] <name> <on|off|reset|resetpriorities>
[root@ndnp /]# chkconfig --list NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off abrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:off abrt-oops 0:off 1:off 2:off 3:on 4:off 5:on 6:off abrtd 0:off 1:off 2:off 3:on 4:off 5:on 6:off acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
修改前:
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
於等級 2、3、4、5 關閉:
[root@ndnp /]# chkconfig --level 2345 iptables off
修改後:
[root@ndnp /]# chkconfig --list | grep iptables iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
補充:在 systemd 取代 SysV init 的版本上,這類需求通常改用 systemctl enable/disable 處理。