summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorShevAbam <shevabam@gmail.com>2015-02-05 18:29:16 +0100
committerShevAbam <shevabam@gmail.com>2015-02-05 18:29:16 +0100
commit086a1829e65a8c148b1f5c4aa6251a29bead3ea6 (patch)
tree633db42727e4a4141651b51d3d7d7ecafa72b94c /libs
parent3ed4c1d633f3ddfc50d921c5d5c19ebf7cf640c4 (diff)
Fixed memory datas on Arch #15
Diffstat (limited to 'libs')
-rw-r--r--libs/memory.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/libs/memory.php b/libs/memory.php
index 67fee34..81d9ac9 100644
--- a/libs/memory.php
+++ b/libs/memory.php
@@ -1,14 +1,19 @@
<?php
require 'Utils/Misc.class.php';
-// Free
-if (!($free = shell_exec('/usr/bin/free -to | grep Mem: | awk \'{print $4+$6+$7}\'')))
+$free = 0;
+
+if (shell_exec('cat /proc/meminfo'))
{
- $free = 0;
+ $free = shell_exec('grep MemFree /proc/meminfo | awk \'{print $2}\'');
+ $buffers = shell_exec('grep Buffers /proc/meminfo | awk \'{print $2}\'');
+ $cached = shell_exec('grep Cached /proc/meminfo | awk \'{print $2}\'');
+
+ $free = (int)$free + (int)$buffers + (int)$cached;
}
// Total
-if (!($total = shell_exec('/usr/bin/free -to | grep Mem: | awk \'{print $2}\'')))
+if (!($total = shell_exec('grep MemTotal /proc/meminfo | awk \'{print $2}\'')))
{
$total = 0;
}