第三种快速处理方法:不要Shell循环语句也一条命令搞定
匿名 · 更新于 2026/8/29
#仅保留crond|sshd|network|rsyslog|sysstat这几项必须服务
[root@www ~]# chkconfig --list|grep 3:on|grep -vE "crond|sshd|network|rsyslog|sysstat"|awk '{print "chkconfig " $1 " off"}'|bash
#查看当前开启的服务
[root@www ~]# chkconfig --list|grep 3:on
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
sysstat 0:off 1:on 2:on 3:on 4:on 5:on 6:off
#End
