1 | #!/usr/bin/perl -w |
---|
2 | |
---|
3 | @cmd = @ARGV; |
---|
4 | |
---|
5 | $start = time(); |
---|
6 | $count = 0; |
---|
7 | while(1) { |
---|
8 | print "pass $count, running command '", join(' ',@cmd),"'\n"; |
---|
9 | $rc = system(@cmd); |
---|
10 | my $signum = $rc & 0xff; |
---|
11 | if ($signum) { |
---|
12 | print "Process died from signal $signum\n"; |
---|
13 | last; |
---|
14 | } |
---|
15 | my $exitcode = $rc >> 8; |
---|
16 | if ($exitcode) { |
---|
17 | print "Process exited with exit code $exitcode\n"; |
---|
18 | last; |
---|
19 | } |
---|
20 | my $elapsed = time() - $start; |
---|
21 | print "command completed successfully, ", |
---|
22 | "pass $count, elapsed time $elapsed seconds\n"; |
---|
23 | $count++; |
---|
24 | } |
---|
25 | |
---|
26 | $elapsed = time() - $start; |
---|
27 | print "loop terminated on pass $count after $elapsed seconds\n"; |
---|
28 | exit 1; |
---|