使用chkconfig批次開關開機自啓動服務:
for services in `chkconfig --list|grep "3:on"|awk '{print $1}'|grep -vE "crond|irqbalance|network|rsyslog|sshd"`; do chkconfig --level 3 $services off; done
#獲取排除crond|irqbalance|network|rsyslog|sshd之外所有3:on的service,並把它們都關閉;
for services in crond irqbalance network rsyslog sshd; do chkconfig --level 3 $services on; done
#查詢crond|irqbalance|network|rsyslog|sshd五項服務,並把他們的level3 都設定爲on的狀態;
chkconfig --list|grep "3:on"|awk '{print $1}'
#列出所有 "3:on"的服務,確保只有這5項被開啓: