lila/bin/restarter_netstat
2012-05-04 01:17:58 +02:00

18 lines
355 B
PHP
Executable file

#!/usr/bin/env php
<?php
require_once __DIR__.'/base_script.php';
$threshold = 890;
$delay = 10;
echo "Restart when java connections exceed $threshold\n";
while (true) {
sleep($delay);
$level = exec('netstat -pan | grep "java" | wc -l');
echo "$level ";
if ($level > $threshold) {
show_run("Restarting", "bin/restart");
}
}