linux chkconfig

2018-11-16 浏览 (1241)

chkconfig命令检查、设置系统的各种服务。这是Red Hat公司遵循GPL规则所开发的程序,它可查询操作系统在每一个执行等级中会执行哪些系统服务,其中包括各类常驻服务。

chkconfig和service 的区别

chkconfig  设置是当前不生效,linux重启后才生效,

service    设置是即时生效,linux关机重启后设置失效

chkconfig 重启后,设置才生效 

开启: chkconfig iptables on 

关闭: chkconfig iptables off 

service 即时生效,重启后设置失效 

开启: service iptables start 

关闭: service iptables stop 

需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。 

chkconfig常见命令参数

   chkconfig [--list] [--type <type>] [name]

   chkconfig --add <name>

   chkconfig --del <name>

   chkconfig --override <name>

   chkconfig [--level <levels>] [--type <type>] <name> <on|off|reset|resetpriorities>

关闭我们不常用的服务

chkconfig |grep 3:on | awk '{print $1}' | grep -Ev "sshd|network|crond|sysstat|rsyslog|mysql" | xargs -I{} chkconfig {} off

  • 所属分类: linux
  • 版权声明: 本文链接 https://seaxiang.com/blog/linux_chkconfig