All pastes #100141 Raw Edit

Someone

public text v1 · immutable
#100141 ·published 2006-07-25 21:36 UTC
rendered paste body
#!/usr/bin/perl -w


use strict;
use POSIX qw(strftime);


my @clients = `/usr/openv/netbackup/bin/admincmd/bppllist -allpolicies -verbose | grep CLIENT | awk {'print \$2'}`;
my @failedClients;
my $zero = 0;
my $numClients = 0;

my $str = join(',',@clients);
foreach my $client (@clients)
{
        my $fulltime = "";
        my $time = "";
        chomp $client;
        $numClients++;

        my @EXIT_STATUS = `/usr/openv/netbackup/bin/admincmd/bperror -client $client | grep "EXIT STATUS" | tail -1`;
        foreach my $exit (@EXIT_STATUS)
        {

                if($exit =~ /^(\d+) /)
                {
                        $time = $1;
                }

                if($exit =~ /EXIT STATUS (\d+)/)
                {

                        if($1 == 0)
                        {
                                $zero++;
                                $str =~ s/$client//g;
                                next;
                        }

                        $fulltime = strftime("%c",localtime($time));
                        print "$fulltime: $client exit status was $1\n";

                        $str =~ s/$client//;

                }
        }
}
$str =~ s/,,/,/g;       ## remove empty array elements
$str =~ s/(^,|,$)//g;   ## remove leading/tailing commas
@clients = split(',',$str);

print "$zero clients ran successfully out of $numClients\n";

foreach my $badclient (@clients)
{
        print "$badclient\n";
}