方法一:两条命令
[root@try ~]# chkconfig --list|grep "3:on"
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
kdump 0:off 1:off 2:off 3:on 4:on 5:on 6:off
mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
postfix 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
udev-post 0:off 1:on 2:on 3:on 4:on 5:on 6:off
[root@try ~]# for oldboy in `chkconfig --list|grep "3:on"|awk '{print $1}'`;do chkconfig $oldboy off;done
[root@try ~]# chkconfig --list|grep "3:on"
[root@try ~]# for oldboy in crond network sshd rsyslog;do chkconfig $oldboy on;done
[root@try ~]# 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
方法二:一条命令
[root@try ~]# chkconfig --list|grep"3:on"|awk '{print $1}'|grep -vE"crond|network|rsyslog|sshd"
auditd
ip6tables
iptables
kdump
mdmonitor
netconsole
netfs
nfs-rdma
postfix
rdisc
rdma
restorecond
saslauthd
sysstat
udev-post
[root@try ~]# for oldboy in `chkconfig--list|grep "3:on"|awk '{print $1}'|grep -vE"crond|network|rsyslog|sshd"`;do chkconfig $oldboy off;done
[root@try ~]# 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
方法三: