#!/bin/bash cpu_usage_idle=`top-b-n1|grepcpu|awk'{print$5}'|cut-f1-d"."` letcpu_usage=100-$cpu_usage_idle mem_total=`awk'/MemTotal/{total=$2}/MemFree/{free=$2}END{print(total-free)/1024}'/proc/meminfo` mem_usage=`echo${mem_total}|awk'{print$1*100/16240}'` month=`date'+%m'` day=`date'+%d'` hour=`date'+%H'` echo"cpu利用率$cpu_usage" echo"内存使用率$mem_usage原文链接:https://www.f2er.com/bash/391550.html