From a03eae77ff86b050ff1e2e0aad3d464cb97e2ae5 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 24 Sep 2024 10:19:42 +0200 Subject: count OK mirrors --- check.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/check.php b/check.php index 946f93c4..a733c2d8 100755 --- a/check.php +++ b/check.php @@ -232,12 +232,13 @@ if ($ref) { printf("%50.50s : ** Corrupted **\n", $mirror); } else if ($ref == $loc) { printf("%50.50s : Ok\n", $mirror); + exit(0); } else if ($loc) { printf("%50.50s : %s\n", $mirror, date('r', $loc)); } else { printf("%50.50s : N/A\n", $mirror); } - break; + exit(1); } continue; } @@ -259,6 +260,7 @@ if ($ref) { } if ($cli) { $nb=count($pids); + $ok=0; while (count($pids)) { if (posix_isatty(STDOUT)) { printf("Wait %d\r", count($pids)); @@ -268,10 +270,11 @@ if ($ref) { die("Cound not wait\n"); exit (1); } else { + if (!pcntl_wexitstatus($status)) $ok++; unset($pids[$pid]); } } - if ($nb) printf("%d mirrors checked.\n", $nb); + if ($nb) printf("%d mirrors checked, %d OK.\n", $nb, $ok); } else { echo "\n"; } -- cgit