From 99253280000dacf1bae22dc8d3b5d888b61deb77 Mon Sep 17 00:00:00 2001
From: Patrick Spek
Date: Mon, 22 May 2023 12:20:12 +0200
Subject: Add the missing memory_free and memory_used for FreeBSD
---
lib/subcommands/sysinfo.bash | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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 ))
--
cgit v1.1