summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2024-09-24 12:34:58 +0200
committerRemi Collet <remi@php.net>2024-09-24 12:34:58 +0200
commit6f305f9335aa05c2e52ffcaf2234eb8e7a416a14 (patch)
tree9e17b1fca88e4636a9967bae4911d95dcbacd345
parenta03eae77ff86b050ff1e2e0aad3d464cb97e2ae5 (diff)
better summary
-rwxr-xr-xcheck.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/check.php b/check.php
index a733c2d8..ed5457d3 100755
--- a/check.php
+++ b/check.php
@@ -235,10 +235,11 @@ if ($ref) {
exit(0);
} else if ($loc) {
printf("%50.50s : %s\n", $mirror, date('r', $loc));
+ exit(1);
} else {
printf("%50.50s : N/A\n", $mirror);
}
- exit(1);
+ exit(2);
}
continue;
}
@@ -259,8 +260,8 @@ if ($ref) {
}
}
if ($cli) {
- $nb=count($pids);
- $ok=0;
+ $nb = count($pids);
+ $ok = $lack = 0;
while (count($pids)) {
if (posix_isatty(STDOUT)) {
printf("Wait %d\r", count($pids));
@@ -270,11 +271,18 @@ if ($ref) {
die("Cound not wait\n");
exit (1);
} else {
- if (!pcntl_wexitstatus($status)) $ok++;
+ switch (pcntl_wexitstatus($status)) {
+ case 0:
+ $ok++;
+ break;
+ case 1:
+ $lack++;
+ break;
+ }
unset($pids[$pid]);
}
}
- if ($nb) printf("%d mirrors checked, %d OK.\n", $nb, $ok);
+ if ($nb) printf("%3d mirrors checked,\n%3d are OK\n%3d are stalled\n%3d are KO.\n", $nb, $ok, $lack, $nb-$ok-$lack);
} else {
echo "</ul>\n";
}