aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2023-05-21 22:42:56 +0200
committerPatrick Spek <p.spek@tyil.nl>2023-05-21 22:42:56 +0200
commit440a94dd4d87b5abff64a5f5720f0808c5cb149f (patch)
tree9dcb9cf2fd509490352c5309c05a5aa80b5002ee
parentd4d5b9ad340873765b5ad969598669c9330350d6 (diff)
Add memory_total and uptime to FreeBSD's sysinfo
-rw-r--r--lib/subcommands/sysinfo.bash2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/subcommands/sysinfo.bash b/lib/subcommands/sysinfo.bash
index d54ca98..fcfbff5 100644
--- a/lib/subcommands/sysinfo.bash
+++ b/lib/subcommands/sysinfo.bash
@@ -21,9 +21,11 @@ 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 ))
storage_used="$(df -c | tail -n1 | awk '{ print $3 }')"
storage_free="$(df -c | tail -n1 | awk '{ print $4 }')"
storage_total=$(( storage_used + storage_free ))
+ uptime=$(( "$(date +%s)" - "$(sysctl -a | awk '/^kern.boottime/ { print substr($5, 0, length($5)-1) }')" ))
;;
*)
load_1="$(awk '{ print $1 }' < /proc/loadavg)"