echo "[CHECKER] Looks like another checker is running, exiting..." . PHP_EOL;
exit(-1);
}
echo "[DB] Fetching hosts to check from database" . PHP_EOL;
echo "[DB] Fetching hosts to check from database" . PHP_EOL;
if ((($options['fullhour'] >= 0) && ($options['fullhour'] <= 23)) && date('H') == $options['fullhour']) { // check all hosts at full check hour
if ((($options['fullhour'] >= 0) && ($options['fullhour'] <= 23)) && date('H') == $options['fullhour'] || $full) { // check all hosts at full check hour or when argument 'full' passed
echo "[CHECKER] Starting FULL check" . PHP_EOL;
$STH = $pdo->query("SELECT `host`, `base32` FROM `hosts`");
$STH = $pdo->query("SELECT `host`, `base32` FROM `hosts`");
} else {
} else {
@ -41,21 +57,27 @@ if ($bob->setnick()) {
}
}
/* Start async checker tasks */
/* Start async checker tasks */
Loop::run(function () use (&$results, $hosts, $options) {
try {
$pool = new DefaultPool($options['checkthreads']);
Loop::run(function () use (&$results, $hosts, $options) {
$pool = new DefaultPool($options['checkthreads']);
$coroutines = [];
$coroutines = [];
foreach ($hosts as $host => $base32) {
foreach ($hosts as $host => $base32) {
$coroutines[$host] = Amp\call(function () use ($pool, $base32, $options) {
$coroutines[$host] = Amp\call(function () use ($pool, $base32, $options) {