系统环境

[root@mysql mysql]# cat /etc/redhat-release
CentOS release 6.4 (Final)
[root@mysql mysql]# uname -m
x86_64
[root@mysql mysql]# uname -r
2.6.32-358.el6.x86_64
[root@mysql mysql]#

关闭不必要的服务:

#!/bin/bash
. /etc/init.d/functions
for i in `chkconfig --list|grep 3:on|awk '{print $1}'`
do
  chkconfig --level 3 $i off
  if [ $? -eq 0 ]
  then
    action  "$i turn off is ok" /bin/true
  else
    action "$i turn off is no" /bin/false
  fi
done
sleep 2
for i in crond rsyslog network sshd `chkconfig --list|grep rpc* | awk '{print $1}'`
do
  chkconfig --level 3 $i on
  if [ $? -eq 0 ]
  then
    action "$i turn on is ok" /bin/true
  else
    action "$i turn on is no" /bin/true
  fi
done
sleep 2