Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2542894
  • 博文数量: 271
  • 博客积分: 6659
  • 博客等级: 准将
  • 技术积分: 3141
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-17 10:24
文章分类

全部博文(271)

文章存档

2016年(2)

2015年(12)

2014年(7)

2013年(19)

2012年(22)

2011年(81)

2010年(128)

分类:

2011-01-09 14:49:21

#!/bin/bash
#Deployment of first use
#1.language
echo 'LANG="en_US.utf8"' > /etc/sysconfig/i18n
LANG=en_US.utf8
lrzsz_http=x.x.x.x

#2.NTP date
ntpdate 0.rhel.pool.ntp.org > /dev/null

#3.Boot options
#total=6
startall=$(chkconfig --list | grep 3:on | awk '{print $1}')
stop=$(echo "$startall" | grep -Ev "crond|iptables|network|sshd|syslog|sysstat")

for server in $stop
        do chkconfig --level 3 $server off
done

startonly=$(chkconfig --list|grep 3:on|awk '{print $1}'| sed 's/^./\t\t&/')

#4.Boot-level
level=$(who -r | awk '{print $2}')
if [ $level != "3" ]
        then sed -i 's/id:.:initdefault:/id:3:initdefault:/' /etc/inittab
fi

#5.install lrzsz
pkg=$(rpm -q lrzsz)
if [[ $pkg == *not* ]]
        then
        lrzsz="lrzsz-0.12.20-22.1.i386.rpm"
        wget http://$lrzsz_http/install/$lrzsz > /dev/null 2>&1
        rpm -ivh $lrzsz > /dev/null 2>&1
        rm -rf $lrzsz
fi
lrzsz=$(which rz)


#6.check gcc
function check_gcc {
gcctotal=$(rpm -qa | grep gcc | wc -l)

if [ $gcctotal -ge "13" ]
          then echo "gcc = $gcctotal"
else
          echo "Warning gcc < $gcctotal"
fi
return
}
#7.release
release=$(echo $(lsb_release -d | awk '{for(i=2;i<=(NF-1);i++)print $i}'))

#8.disk
function disk {
df -h | sed 's/^./\t\t&/'
}

#9.Result
clear
echo -e "Date:\t\t$(date "+%F %T")"
echo
echo -e "Release:\t$release"
echo
echo -e "Gcc:\t\t$(check_gcc)"
echo
echo -e "Startlevel:\t$level"
echo
echo -e "Language:\t$LANG"
echo
echo -e "RZ:\t\t$lrzsz"
echo
echo "Boot options:"
echo "$startonly"
echo
echo -e "Disk:\n" ; disk


阅读(871) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2011-03-09 13:38:50

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com