From c0b0d87ff4ef9beff7776511f5b54ae1c9be9259 Mon Sep 17 00:00:00 2001 From: BANKA2017 <17263253+BANKA2017@users.noreply.github.com> Date: Sun, 20 Feb 2022 15:59:43 +0800 Subject: [PATCH] Fix: function usedMemory While language in console is not English, this function may return `nan` --- app/lib/system.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/system.php b/app/lib/system.php index 3b09fb84..ee21ad84 100644 --- a/app/lib/system.php +++ b/app/lib/system.php @@ -42,7 +42,7 @@ class Sysinfo public function usedMemory() { - $used = shell_exec("free -m | awk '/Mem:/ { total=$2 ; used=$3 } END { print used/total*100}'"); + $used = shell_exec("free -m | awk 'NR==2{ total=$2 ; used=$3 } END { print used/total*100}'"); return floor($used); }