用脚本关闭linux不用的服务

#! /bin/bash

services=`chkconfig --list|awk '{print $1}'`
for ser in $services
do
if [ "$ser" == "network" ] || [ "$ser" == "syslog" ] || [ "$ser" == "sshd" ] || \
[ "$ser" == "crond" ] || [ "$ser" == "atd" ] || [ "$ser" == "irqbalance" ] || \
[ "$ser" == "microcode_ctl" ] || [ "$ser" == "sendmail" ] ;
then
chkconfig --leve 3 "$ser" on
else
chkconfig "$ser" off
fi
done
echo "The unavaliable service has been shutdown successfully!"
sleep 5
init 6

添加新评论 »