天天看點

系統初始化腳本

 #! /bin/bash 

#welcome 

cat << EOF 

+--------------------------------------------------------------+ 

|         === Welcome to Centos System init ===                | 

+--------------http://91cto.zzl.org------------------------+ 

+----------------------Author:JadeShow--------------------------+ 

EOF 

#disable ipv6 

|         === Welcome to Disable IPV6 ===                      | 

echo "alias net-pf-10 off" >> /etc/modprobe.conf 

echo "alias ipv6 off" >> /etc/modprobe.conf 

/sbin/chkconfig --level 35 ip6tables off 

echo "ipv6 is disabled!" 

#disable selinux 

sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config  

echo "selinux is disabled,you must reboot!" 

#vim 

sed -i "8 s/^/alias vi='vim'/" /root/.bashrc 

echo 'syntax on' > /root/.vimrc 

#zh_cn 

sed -i -e 's/^LANG=.*/LANG="en_UTF8"/'   /etc/sysconfig/i18n 

#tunoff services 

#-------------------------------------------------------------------------------- 

|         === Welcome to Tunoff services ===                   | 

#--------------------------------------------------------------------------------- 

for i in `ls /etc/rc3.d/S*` 

do 

             CURSRV=`echo $i|cut -c 15-` 

echo $CURSRV 

case $CURSRV in      

     crond | irqbalance | microcode_ctl | network | random | sendmail | sshd | syslog | local | mysqld ) 

     echo "Base services, Skip!" 

     ;; 

     *) 

         echo "change $CURSRV to off" 

         chkconfig --level 235 $CURSRV off 

         service $CURSRV stop 

esac 

done 

init 6 

     本文轉自 珏石頭 51CTO部落格,原文連結:http://blog.51cto.com/gavinshaw/322307,如需轉載請自行聯系原作者