summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Debesse <dev@illwieckz.net>2016-04-29 12:44:45 +0200
committerThomas Debesse <dev@illwieckz.net>2016-04-29 12:47:10 +0200
commit14b8e3299e0ea3c382776f92a45fc9ce7fae8e4c (patch)
tree813ea4ef5c6f11f188d07fdaac7e5e535f0966a3
parent92289c867458f15132a5ed446cd300f94bce6bee (diff)
use MemAvailable as mem_free (exclude cached memory)
-rwxr-xr-xsysinfo.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/sysinfo.sh b/sysinfo.sh
index 796922d..7fbb6f1 100755
--- a/sysinfo.sh
+++ b/sysinfo.sh
@@ -10,7 +10,7 @@ uptime=`uptime | sed -e 's/[ ][ ]*/ /g;s/ [0-9:]* up \(.*\), [0-9]* user.*/\1/'`
#--- [ MEMORY ] -----------------------
mem_total=`cat /proc/meminfo | grep -i MemTotal | awk '{printf "%d",$2/1024;}'`
-mem_free=`free | tail -n2 | head -n1 | sed 's/^.*://' | awk '{printf "%d",$2/1024;}'`
+mem_free=`cat /proc/meminfo | grep -i MemAvailable | awk '{printf "%d",$2/1024;}'`
mem_used=`echo ${mem_total} ${mem_free} | awk '{printf "%d",$1-$2;}'`
swap_total=`cat /proc/meminfo | grep -i SwapTotal | awk '{printf "%d",$2/1024;}'`