Fix: function usedMemory

While language in console is not English, this function may return `nan`
This commit is contained in:
BANKA2017 2022-02-20 15:59:43 +08:00 committed by GitHub
parent 4299d4d7cc
commit c0b0d87ff4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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);
}