0
#!/bin/bash
#this shell script is used to shutdown services that is off in lever15 by shell
#order chkconfig.once you run this shell script then restart the system,it will
#permanently get effective.
#if you want to start closed services,you can run "chkconfig servicename on" in
#shell in terms of root privillage.
chkconfig|awk '/1:off/&&/3:on/&&/5:off/{print $1}' >> servicesoff
sum=`grep -c '.' servicesoff`
echo "shutdown services amount: $sum"
oIFS=$IFS
IFS=" "
while read service
do
chkconfig $service off
done
rm -f servicesoff
#this shell script is used to shutdown services that is off in lever15 by shell
#order chkconfig.once you run this shell script then restart the system,it will
#permanently get effective.
#if you want to start closed services,you can run "chkconfig servicename on" in
#shell in terms of root privillage.
chkconfig|awk '/1:off/&&/3:on/&&/5:off/{print $1}' >> servicesoff
sum=`grep -c '.' servicesoff`
echo "shutdown services amount: $sum"
oIFS=$IFS
IFS=" "
while read service
do
chkconfig $service off
done
0
#!/bin/bash
ver=`cat /etc/issue|head -n1 |awk '{print $3}'|awk -F '.' '{print $1}'`
svr_list=/tmp/startup.txt
if [ $ver -ne 6 ]
then
echo "This sccript suitable for Centos release 6.x"
exit 1
fi
[ -e $svr_list ] || touch $svr_list
if [ ! -s $svr_list ]
then
echo "please input the server name you want to start when system boot into $svr_list"
echo "one server name ONE LINE or one server name ONE SPACE"
exit 1
fi
for i in `chkconfig --list |awk '{print $1}'`
do
chkconfig $i off
done
for a in `cat $svr_list`
do
chkconfig $a --level 3 on
done
ver=`cat /etc/issue|head -n1 |awk '{print $3}'|awk -F '.' '{print $1}'`
svr_list=/tmp/startup.txt
if [ $ver -ne 6 ]
then
echo "This sccript suitable for Centos release 6.x"
exit 1
fi
[ -e $svr_list ] || touch $svr_list
if [ ! -s $svr_list ]
then
echo "please input the server name you want to start when system boot into $svr_list"
echo "one server name ONE LINE or one server name ONE SPACE"
exit 1
fi
for i in `chkconfig --list |awk '{print $1}'`
do
chkconfig $i off
done
for a in `cat $svr_list`
do
chkconfig $a --level 3 on
done
编辑回复