1

Does anyone know how to get the write time of a Netbackup job from the command line or a log? In the GUI, when I go to job details, it does tell me the write time. However, with bpdbjobs -all_columns the 'elapsed' column shows how long the job took, but not the actual write time.

2
  • I just realized who ever decided to put the letters 'bpdb' as the start of a command must have had something personal against dyslexic people. Jun 10, 2009 at 12:13
  • Just a bit of trivia, but this explains why the commands start with bp (for BackupPlus) and why the directories are named openv (for Openvision). en.wikipedia.org/wiki/NetBackup
    – TCampbell
    Jun 10, 2009 at 13:18

1 Answer 1

1

Actually, there is a field from bpdbjobs -all_columns that looks like '06/09/09 19:41:27 - end writing; write time: 000:06:56'. It might appear multiple times for one job, and isn't always at the same index. But my iterating over all the fields it is easy enough to parse them out and convert it to seconds and add it all up.

Something like:

sub stripLeadZeros {
    my $number = shift;
    $number =~ s/^0+//;
    return $number;
}

sub parseWriteTime {
    my $writeString = shift;
    if ( $writeString =~ /([0-9]{3}):([0-9]{2}):([0-9]{2})/ ) {
        my $hours = stripLeadZeros($1) || 0;
        my $minutes = stripLeadZeros($2) || 0;
        my $seconds = stripLeadZeros($3) || 0;
        my $totalSec = (($hours * 60) * 60) + ($minutes * 60) + $seconds;
        return $totalSec;
    }
    return 0;
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .