summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-09-24 10:19:42 +0200
committerRemi Collet <remi@php.net>2024-09-24 10:19:42 +0200
commita03eae77ff86b050ff1e2e0aad3d464cb97e2ae5 (patch)
treeeb18efb6832d01de7fc4b471a303f1a88c7874a6
parent3849f521ebf94f3287af201d012539802dae835e (diff)
count OK mirrors
-rwxr-xr-xcheck.php7
1 files 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 "</ul>\n";
}