Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  Kyle Brandt Jun 10 '09 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 '09 at 13:18

1 Answer 1

up vote 1 down vote accepted

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;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.