projects
/
chksht.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
cf07941
)
Added hung check handling
author
Chip Black
<bytex64@bytex64.net>
Mon, 18 Aug 2008 07:31:17 +0000
(
02:31
-0500)
committer
Chip Black
<bytex64@bytex64.net>
Mon, 18 Aug 2008 07:31:17 +0000
(
02:31
-0500)
runcheckdir
patch
|
blob
|
history
diff --git
a/runcheckdir
b/runcheckdir
index
6b5bcca
..
d6589f2
100755
(executable)
--- a/
runcheckdir
+++ b/
runcheckdir
@@
-80,11
+80,24
@@
if ($td < $every) {
exit $oldstatus;
}
exit $oldstatus;
}
-open CHECK, '-|', $checkcommand;
+my ($pid, $hung, $exitstatus);
+$SIG{ALRM} = sub {
+ kill 9, $pid;
+ $hung = 1;
+};
+alarm 10;
+
+$pid = open CHECK, '-|', $checkcommand;
$status = <CHECK>;
$details = join('', <CHECK>);
close CHECK;
$status = <CHECK>;
$details = join('', <CHECK>);
close CHECK;
-my $exitstatus = $? >> 8;
+if ($hung) {
+ $status = 'TIMEOUT';
+ $details = 'Check did not complete within ten seconds';
+ $exitstatus = -1;
+} else {
+ $exitstatus = $? >> 8;
+}
if ($exitstatus == 0 && $oldstatus != 0) {
do_command($_) foreach @{$on{success}};
if ($exitstatus == 0 && $oldstatus != 0) {
do_command($_) foreach @{$on{success}};