RaspiStream/var/www/api/ram-alloc.api.php
2017-05-19 12:09:07 +02:00

11 lines
252 B
PHP

<?php
include('../includes/common.inc.php');
checkReferrer() or die();
$data = shell_exec("free -m | awk 'NR==2{printf \"%s/%sMB %.2f%\", \$3,\$2,\$3*100/\$2 }'");
$s = explode(' ', $data);
echo json_encode(array(
'mb' => $s[0],
'pc' => $s[1]
));
?>