12 lines
357 B
PHP
12 lines
357 B
PHP
#!/usr/bin/php
|
|
<?php
|
|
|
|
$memory = trim(shell_exec("free -b | grep Mem:"));
|
|
$memory = str_replace(" ", " ", $memory);
|
|
while (str_contains($memory, " ")) $memory = str_replace(" ", " ", $memory);
|
|
$items = explode(" ", $memory);
|
|
$available = intval($items[count($items) - 1]) / 1024 / 1024;
|
|
|
|
if ($available < 25) {
|
|
shell_exec("systemctl restart grass");
|
|
} |