Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6854819
  • 博文数量: 3857
  • 博客积分: 6409
  • 博客等级: 准将
  • 技术积分: 15948
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-02 16:48
个人简介

迷彩 潜伏 隐蔽 伪装

文章分类

全部博文(3857)

文章存档

2017年(5)

2016年(63)

2015年(927)

2014年(677)

2013年(807)

2012年(1241)

2011年(67)

2010年(7)

2009年(36)

2008年(28)

分类:

2011-04-08 14:19:44

  有时从源更新内核后grub的配置文件有点问题造成重启后无法启动。尤其是远程更新重启后比较麻烦。写了个脚本可以检测grub2的配置文件
  1. #!/bin/bash
  2. end="\e[0m"
  3. red="\e[1;31;40m"
  4. ver="\e[1;32;40m"
  5. yel="\e[1;33;40m"
  6. blu="\e[1;34;40m"
  7. pur="\e[1;35;40m"
  8. gre="\e[1;36;40m"
  9. whi="\e[1;37;40m"
  10. filein=/boot/grub/grub.cfg
  11. fileout=/var/tmp/$$.list
  12. echo -e "${pur}checking the kernel image file${end}"
  13. grep "vmlinuz" $filein|awk '{print $2}'|uniq >$fileout
  14. grep "initrd" $filein|awk '{print $2}'|uniq >>$fileout
  15. cat $fileout
  16. echo -e "${pur}test the image file${end}"
  17. error=0
  18. while read i
  19. do
  20. if [ ! -s $i ];
  21. then
  22. printf "error! can't find $red%s$end\n" $i
  23. error=$((++error))
  24. fi
  25. done <$fileout
  26. rm -rf $fileout
  27. if [ $error -gt 0 ]
  28. then
  29. echo -e "there is some wrong with the file:" $yel$filein$end
  30. else
  31. echo -e "${blu}OK,all is good!${end}"
  32. fi

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