in reply to Failboat -- An Emotionally Disturbed Tool For Checking NetBackup Client Coverage
spinUp(); collectJobs(); parseJobs(); spinDown(); sub spinUp() {
Why the subroutines? All the variables are global and nothing is passed to them so it's not to protect local variables. They are only called once at the beginning of the script so it's not to reuse code. What is the point?
foreach $item (@tempJobsTable) { $item=~s/\s+/ /g; @thisJob=split(" ",$item);
If the first argument to split is a string containing a single space character then split removes all whitespace characters so your use of a substitution to remove all whitespace characters first is redundant. You can achieve exactly the same result like this:
foreach (@tempJobsTable) { @thisJob=split;
if ($failureType{$thisJob[6]}=="") { $failureType{$thisJob[6]}=$thisJob[3]; }
You are using a numerical comparison operator on a string so perl will conveniently convert that string to the number 0 to perform the comparison. Perhaps you meant to use the eq string comparison operator instead? Or the exists or defined funtions?
$lastValidBackupTime=`/usr/openv/netbackup/bin +/admincmd/bpcatlist -client $client 2>&1 | grep $client | head -n1 | +awk '{print $2}'`;
You are getting a single field from a single line from an externally executed command. Because AWK splits its fields on whitespace the only whitespace in the returned string will be the newline that the backquotes add.
$lastValidBackupTime=~s/\s+/ /g;
You are converting the newline at the end of the string to a single space character.
@temp=split(" ",$lastValidBackupTime);
You are assigning to $temp[0] the contents of $lastValidBackupTime.
$lastValidBackupTime="$temp[1] $temp[2] $temp[ +3] $temp[4]";
You are assigning to $lastValidBackupTime the string " ".
Why did you do all that just to assign three spaces to $lastValidBackupTime?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Failboat -- An Emotionally Disturbed Tool For Checking NetBackup Client Coverage
by Anonymous Monk on Mar 19, 2010 at 04:27 UTC | |
|
Re^2: Failboat -- An Emotionally Disturbed Tool For Checking NetBackup Client Coverage
by Anonymous Monk on Mar 19, 2010 at 18:12 UTC | |
by jwkrahn (Abbot) on Mar 19, 2010 at 18:48 UTC |