Chinaunix首页 | 论坛 | 博客
  • 博客访问: 405126
  • 博文数量: 112
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 800
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-29 13:41
文章分类

全部博文(112)

文章存档

2020年(1)

2018年(10)

2017年(27)

2016年(18)

2015年(31)

2014年(25)

分类: 系统运维

2016-04-01 11:13:09


点击(此处)折叠或打开

  1. #!/bin/bash
  2. #This script is used to check the games info

  3. #divce_info
  4. divce_info ()
  5. {
  6. echo -e "\033[1;31m---------------Begin check hardware divce---------------\033[0m"
  7. sleep 1
  8. local DEV_VEN=`dmidecode |grep Vendor|cut -d":" -f2`
  9. local DEV_PRO=`dmidecode |grep "Product Name"|awk 'NR==1'|cut -d":" -f2`
  10. echo -e "\033[1;32mHARDWARE INFO:\033[0m $DEV_VEN\t$DEV_PRO."
  11. echo

  12. }
  13. #system_info
  14. system_info ()
  15. {
  16. echo -e "\033[1;31m---------------Begin check system info---------------\033[0m"
  17. sleep 1
  18. local SYS_VER=`cat /etc/redhat-release`
  19. local SYS_KER=`uname -rs`
  20. echo -e "\033[1;32mSYSTEM_RELEASE:\033[0m $SYS_VER"
  21. echo
  22. echo -e "\033[1;32mKERNEL_RELEASE:\033[0m $SYS_KER"
  23. }
  24. #cpu_info
  25. cpu_info ()
  26. {
  27. echo -e "\033[1;31m---------------Begin check cpu info---------------\033[0m"
  28. sleep 1
  29. local CPU_FRE=`cat /proc/cpuinfo |grep "model name"|awk -F: 'NR==1{print $2}'`
  30. local CPU_CORE=`cat /proc/cpuinfo |grep "cpu cores"|awk -F: 'NR==1{print $2}'`
  31. local CPU_PRO=`cat /proc/cpuinfo |grep 'processor'|sort -u|wc -l`
  32. local CPU_PHY_COUNT=`cat /proc/cpuinfo |grep 'physical id' |awk '!a[$0]++' |wc -l`
  33. local CPU_CACHE_SIZE=`cat /proc/cpuinfo |grep "cache size"|awk -F: 'NR==1{print $2}'`
  34. echo -e "\033[1;32mCPU FREQUENCY:\033[0m $CPU_FRE"
  35. echo -e "\033[1;32mCPU CORES:\033[0m $CPU_CORE"
  36. echo -e "\033[1;32mCPU PROCESSOR:\033[0m $CPU_PRO"
  37. echo -e "\033[1;32mCPU PHYSICAL COUNT:\033[0m $CPU_PHY_COUNT"
  38. echo -e "\033[1;32mCPU CACHE SIZE:\033[0m $CPU_CACHE_SIZE"
  39. }
  40. #memory_info
  41. mem_info ()
  42. {
  43. echo -e "\033[1;31m---------------Begin check memory info---------------\033[0m"
  44. sleep 1
  45. local MEM_TOT=$(echo `cat /proc/meminfo |awk 'NR==1{print $2}'`/1024|bc)
  46. local MEM_COUNT=`dmidecode |grep -A16 "Memory Device$"|grep Size|awk -F: '{if($2!~/No/)print $0}'|wc -l`
  47. echo -e "\033[1;32mMEMORY TOTAL:\033[0m ${MEM_TOT}MB"
  48. echo -e "\033[1;32mMEMORY COUNT:\033[0m $MEM_COUNT"
  49. }
  50. #diskand partition
  51. disk_partitions ()
  52. {
  53. echo -e "\033[1;31m---------------Begin check disk info---------------\033[0m"
  54. sleep 1
  55. local SWAP_INFO=`cat /proc/swaps |sed -n '2p'|awk '{print $1}'`
  56. local DISK_INFO=`/sbin/fdisk -l|grep Disk|awk -F, '{print $1}'`
  57. local PART_INFO=`df -h |grep -v Filesystem|sed "s#none#$SWAP_INFO#"`
  58. echo -e "\033[1;32mSWAP INFO:\033[0m $SWAP_INFO"
  59. echo -e "\033[1;32mDISK INFO:\033[0m $DISK_INFO"
  60. echo -e "\033[1;32mPARTITIONS INFO:\033[0m \n$PART_INFO"
  61. }
  62. #check_times
  63. check_time ()
  64. {
  65. echo -e "\033[1;31m---------------Begin check times info---------------\033[0m"
  66. local PROGRAM=`ps aux |grep "GameCenter"|grep -v grep|wc -l`
  67. if [ $PROGRAM != 0 ];then
  68.     echo -e "Server Program is running!!!"
  69. else
  70.    sudo /usr/sbin/ntpdate 192.168.3.251
  71. fi
  72. }
  73. divce_info
  74. system_info
  75. cpu_info
  76. mem_info
  77. disk_partitions
  78. check_time

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