Earindil has asked for the wisdom of the Perl Monks concerning the following question:
eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm 10; system("/nsh/bin/nexec $node \"date\" > /dev/null 2>&1"); alarm 0; }; if ($@) { ### Timed Out print "Block 1 Alarm, blkillhung $node\n"; &killhung($node); $CMOK = 1; eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n req +uired alarm 10; system("rcmd -q -n $node \"date\" > /tmp/date.${node}" +); alarm 0; }; if ($@) { ### Timed Out print "Block 2 Alarm, killhung $node\n"; &killhung($node); $CMOK = 1; } else { $CMOK = 0; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: eval and alarm
by kyle (Abbot) on Oct 02, 2007 at 16:37 UTC | |
by Earindil (Beadle) on Oct 02, 2007 at 16:43 UTC |