Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
elunez committed May 22, 2023
1 parent f232040 commit d1d9e71
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions other_script/hostinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ while true; do
cpu_idle=$(awk -v usage="$cpu_usage" 'BEGIN {print 100 - usage}')
load_average=$(cat /proc/loadavg | awk '{print $1, $2, $3}')

# 获取内存信息
mem_total=$(free -m | awk '/^Mem:/ {print $2}')
mem_used=$(free -m | awk '/^Mem:/ {print $6 - $3}')
mem_free=$((mem_total - mem_used))

# 获取硬盘信息
disk_total=$(df -h --output=size / | awk 'NR==2' | sed 's/G//' | tr -d '[:space:]')
disk_used=$(df -h --output=used / | awk 'NR==2' | sed 's/G//' | tr -d '[:space:]')
Expand All @@ -29,8 +24,6 @@ while true; do
echo -e "CPU核心: $cpu_count 核心 | CPU型号: $cpu_model $cpu_frequency MHz"
echo "--------------------------CPU负载----------------------------"
echo -e "CPU使用率: $cpu_usage % | CPU空闲率: $cpu_idle % | 负载参数: $load_average"
echo "--------------------------内存信息---------------------------"
echo -e "内存大小: $mem_total MB | 已使用: $mem_used MB | 未使用: $mem_free MB"
echo "---------------------------磁盘信息--------------------------"
echo -e "磁盘大小: $disk_total G | 已使用: $disk_used G | 未使用: $disk_free G"
echo "-------------------------------------------------------------"
Expand Down

0 comments on commit d1d9e71

Please sign in to comment.