日常巡检脚本的编写

#!/bin/bash
一 ************* ***************** *********************************** echo "##################################系统信息#############################################" OS_TYPE=`uname` OS_VSR=`cat /etc/redhat-release` OS_KER=`uname -a| awk '{print $3}'` OS_TIME=`date +%F_%T` OS_RUN_TIME=`uptime | awk '{print $3}'` OS_LAST_ERBOOT_TIME=`who -b | awk '{print $2,$3}'` OS_HOSTNAME=`hostname` echo "系统类型:$OS_TYPE" echo "系统版本:$OS_VSR" echo "系统内核:$OS_KER" echo "当前时间:$OS_TIME" echo "运行时间:$OS_RUN_TIME" echo "最后重启时间:$OS_LAST_ERBOOT_TIME" echo "本机名称:$OS_HOSTNAME" 二 ************** *************** ********************** echo "##################################硬件信息#########################################" CPUID=`grep "physical id" /proc/cpuinfo |sort|uniq|wc -l` CPUCORES=`grep "cores" /proc/cpuinfo|sort|uniq|awk -F: '{print $2}'` CPUMODE=`grep "model name" /proc/cpuinfo|sort|uniq|awk -F: '{print $2}'` echo " CPU数量: $CPUID" echo " CPU核心:$CPUCORES" echo " CPU型号:$CPUMODE" MEMTOTAL=`free -m|grep Mem|awk '{print $2}'` MEMFREE=`free -m|grep Mem|awk '{print $4}'` echo " 内存总容量: ${MEMTOTAL}MB" echo "剩余内存容量: ${MEMFREE}MB"

  

posted on 2019-09-28 20:29  快乐的人啊  阅读(309)  评论(0编辑  收藏  举报

导航