diff --git a/src/warden-server/bin/getClients.pl b/src/warden-server/bin/getClients.pl index 1649ed25d6a908f6c4e8186cd2ec017cb434dc2d..96f9e4018489afbeb1ad30b92871c1bdd2f2e365 100755 --- a/src/warden-server/bin/getClients.pl +++ b/src/warden-server/bin/getClients.pl @@ -35,13 +35,14 @@ WardenCommon::loadConf($conf_file); # FUNCTIONS ################################################################################ sub usage { - print "Usage: $RealScript (without parameters) [-h -V]\n"; + print "Usage: $RealScript [-a -h -V]\n"; exit 1; } sub help { - print "$RealScript (without parameters) [-h -V]\n"; + print "$RealScript [-a -h -V]\n"; + print "-a print all clients (invalid clients included)\n"; print "-h print this text and exit\n"; print "-V print version and exit\n"; exit 0; @@ -57,9 +58,10 @@ sub version { ################################################################################ # MAIN ################################################################################ -our ($opt_h, $opt_V); +our ($opt_a, $opt_h, $opt_V); -die usage unless getopts("hV"); +die usage unless getopts("ahV"); +my $all = $opt_a; my $help = $opt_h; my $script_version = $opt_V; @@ -77,7 +79,12 @@ if ($script_version) { my $dbh = WardenCommon::connectDB; # obtain data from DB -my $sth = $dbh->prepare("SELECT * FROM clients ORDER BY client_id ASC;") or die "Cannot prepare statement: " . $dbh->errstr; +my $sth; +if ($all) { + $sth = $dbh->prepare("SELECT * FROM clients ORDER BY client_id ASC;") or die "Cannot prepare statement: " . $dbh->errstr; +} else { + $sth = $dbh->prepare("SELECT * FROM clients WHERE valid='t' ORDER BY client_id ASC;") or die "Cannot prepare statement: " . $dbh->errstr; +} $sth->execute or die "Cannot execute statement: " . $sth->errstr; my $hash_ref = $sth->fetchall_hashref("client_id"); diff --git a/src/warden-server/doc/README b/src/warden-server/doc/README index 8077c15b64b1ebc4142f6a5361a04c161a9fb86e..1c2d6cd7f54a78064868e2d48fcb057ed15a603c 100644 --- a/src/warden-server/doc/README +++ b/src/warden-server/doc/README @@ -368,8 +368,9 @@ H. Status Info 2. Get Clients - Function getClients is accessible via getClients.pl. Function has no input - parameters and returns detailed information about all registered clients. + Function getClients is accessible via getClients.pl. Function returns detailed + information about valid or all (-a) registered clients. Parameter -a returns + valid and invalid clients together. -------------------------------------------------------------------------------- I. Warden Watchdog