Add usedDisk() public method

This commit is contained in:
billz
2025-06-21 01:55:22 -07:00
parent 72d7028e25
commit 3b35f5a0c6

View File

@@ -46,12 +46,18 @@ class Sysinfo
return $systime;
}
public function usedMemory()
public function usedMemory(): int
{
$used = shell_exec("free -m | awk 'NR==2{ total=$2 ; used=$3 } END { print used/total*100}'");
return floor(intval($used));
}
public function usedDisk(): int
{
$output = shell_exec("df -h / | awk 'NR==2 {print $5}'");
return intval(str_replace('%', '', trim($output)));
}
public function processorCount()
{
$procs = shell_exec("nproc --all");