Update Limiting_Shut_down.sh

This commit is contained in:
科技lion 2025-02-20 14:51:02 +08:00 committed by GitHub
parent 7800752d23
commit 7217f5edeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,11 +2,12 @@
# 获取总的接收和发送流量
output=$(awk 'BEGIN { rx_total = 0; tx_total = 0 }
NR > 2 { rx_total += $2; tx_total += $10 }
$1 ~ /^(eth|ens|enp|eno)[0-9]+/ { rx_total += $2; tx_total += $10 }
END {
printf("%.0f Bytes %.0f Bytes", rx_total, tx_total);
}' /proc/net/dev)
# 获取接收和发送的流量数据
rx=$(echo "$output" | awk '{print $1}')
tx=$(echo "$output" | awk '{print $3}')