Reintroduced fix.
This commit is contained in:
parent
8effb120dd
commit
764f267dbe
1 changed files with 6 additions and 1 deletions
|
@ -17,9 +17,14 @@ get_percent()
|
||||||
case $(uname -s) in
|
case $(uname -s) in
|
||||||
Linux)
|
Linux)
|
||||||
# percent=$(free -m | awk 'NR==2{printf "%.1f%%\n", $3*100/$2}')
|
# percent=$(free -m | awk 'NR==2{printf "%.1f%%\n", $3*100/$2}')
|
||||||
|
total_mem_gb=$(free -g | awk '/^Mem/ {print $2}')
|
||||||
used_mem=$(free -g | awk '/^Mem/ {print $3}')
|
used_mem=$(free -g | awk '/^Mem/ {print $3}')
|
||||||
total_mem=$(free -h | awk '/^Mem/ {print $2}')
|
total_mem=$(free -h | awk '/^Mem/ {print $2}')
|
||||||
if (( $used_mem == 0 )); then
|
if (( $total_mem_gb == 0)); then
|
||||||
|
memory_usage=$(free -m | awk '/^Mem/ {print $3}')
|
||||||
|
total_mem_mb=$(free -m | awk '/^Mem/ {print $2}')
|
||||||
|
echo $memory_usage\M\B/$total_mem_mb\M\B
|
||||||
|
elif (( $used_mem == 0 )); then
|
||||||
memory_usage=$(free -m | awk '/^Mem/ {print $3}')
|
memory_usage=$(free -m | awk '/^Mem/ {print $3}')
|
||||||
echo $memory_usage\M\B/$total_mem\G\B
|
echo $memory_usage\M\B/$total_mem\G\B
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue