From ebf0a104ed3435236bc82c94c8ca049f2aa08816 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Sat, 8 Sep 2007 16:44:31 +0000 Subject: [PATCH] added -s(leep) option --- org.glite.lb.client/examples/purge_test | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/org.glite.lb.client/examples/purge_test b/org.glite.lb.client/examples/purge_test index c9f05c1..edd23e2 100644 --- a/org.glite.lb.client/examples/purge_test +++ b/org.glite.lb.client/examples/purge_test @@ -1,5 +1,7 @@ #!/usr/bin/perl +use Getopt::Std; + BEGIN{ @@ -14,6 +16,8 @@ $log = "$test/glite-lb-job_log"; $prefix = "/tmp/purge_test_$$"; $delay = 60; +getopts 's:'; + $ENV{PATH} .= ":$bin"; } @@ -29,14 +33,14 @@ die qq{ Don't run it unless you are absolutely sure what you are doing. If you really mean it, the magic usage is: - $0 --i-want-to-purge server:port + $0 [-s sleep] i-want-to-purge server:port Good luck! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -} unless $option eq '--i-want-to-purge'; +} unless $option eq 'i-want-to-purge'; die "usage: $0 --i-want-to-purge server:port\n" unless $server; @@ -53,11 +57,14 @@ sub logit { $id =~ s/EDG_JOBID=//; $ids->{$key} = $id; #print "$status $id | head -1\n"; + sleep $opt_s; $stat = `$status $id | head -2 | tail -1`; chomp $stat; $stat =~ s/state :\s*//; -#print "$id: ".uc($stat)." ".uc($_)."\n"; - $failed = 1 if uc($stat) ne uc($_); + if (uc($stat) ne uc($_)) { + $failed = 1; + print STDERR "FAIL: $id: ".uc($stat)." ".uc($_)."\n"; + } system "$log $id | grep -v '^[ ]*\$' | grep -v '^Found' >${prefix}_$_"; } -- 1.8.2.3