#/usr/bin/env bash
service(){
need_srv="network sshd ntpd crond irqbalance iptables mdmonitor smartd messagebus xinetd openstack-ceilometer-compute openstack-nova-compute openstack-nova-extend openstack-nova-network"
forbidden=$(chkconfig --list | grep -Ei '(2|3|4|5):on' | awk '{ print $1 }'|grep -Evi "`echo $need_srv|sed 's, *,|,g'`" )
for _name in $forbidden
do
chkconfig --level 2345 $_name off > /dev/null 2>&1
done
for _name in $need_srv
do
chkconfig --level 2345 $_name on > /dev/null 2>&1
done
}
service
本文转自 swq499809608 51CTO博客,原文链接:http://blog.51cto.com/swq499809608/1380487