aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2023-05-22 12:20:12 +0200
committerPatrick Spek <p.spek@tyil.nl>2023-05-22 12:20:12 +0200
commit99253280000dacf1bae22dc8d3b5d888b61deb77 (patch)
treea26fc013d5236523c40db6b7bd12f26c76069612
parent45f2cd5e890e51332e06333e185d4ed19dc8bbd3 (diff)
Add the missing memory_free and memory_used for FreeBSD
-rw-r--r--lib/subcommands/sysinfo.bash4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/subcommands/sysinfo.bash b/lib/subcommands/sysinfo.bash
index 5514c43..1b34993 100644
--- a/lib/subcommands/sysinfo.bash
+++ b/lib/subcommands/sysinfo.bash
@@ -21,7 +21,9 @@ subcommand() {
load_1="$(uptime | awk -F' *,? *' '{ print $(NF-2) }')"
load_5="$(uptime | awk -F' *,? *' '{ print $(NF-1) }')"
load_15="$(uptime | awk -F' *,? *' '{ print $NF }')"
- memory_total=$(( "$(sysctl hw.physmem | awk '{ print $NF }')" / 1024 ))
+ memory_total=$(( $(sysctl -n hw.physmem) / 1024 ))
+ memory_used=$(( ( $(sysctl -n vm.stats.vm.v_active_count) * $(sysctl -n hw.pagesize) ) / 1024 ))
+ memory_free=$(( memory_total - memory_used))
storage_used="$(df -c | tail -n1 | awk '{ print $3 }')"
storage_free="$(df -c | tail -n1 | awk '{ print $4 }')"
storage_total=$(( storage_used + storage_free ))