Wednesday, September 28, 2011

some random computer stuff

A script to send email about netbackup tape changes. I got the original from a contractor I work with at DPL sometimes.
#!/usr/bin/perl -w

#who get mail to eject tapes from the library
#$operator="marti,joshw";
$operator="netbackupadmin";

#who get mail to return tapes from the vault
$courier="netbackupop";

# make associative array of offsite media
open(PIPE,"/usr/openv/netbackup/bin/goodies/available_media|") || die "Could not run available_media";
while() {
chop($_);
if( /^Off/ ) {
;
while() {
if(/^$/) { last; };
chop($_);
($evid,$mtype,$rtype,$robot,$slot,$face,$reten,$size,$status) = split(/\s+/,$_);
if($reten =~ /\d/) {
$volumes{$evid}{slot} = $slot;
}
}
}
}
close(PIPE);

# if a media id has a numeric slot number
# it needs to be pulled from the library
foreach $evid (sort keys %volumes) {

if( $volumes{$evid}{slot} =~ /\d/ ) {
push(@eject,$evid);
delete($volumes{$evid});
}

}
#
#
# we need to check the expiration date of the rest of the media to see if
# they need to be returned from the offsite tape vault

$now = time();
foreach $evid (sort keys %volumes) {
open(PIPE,"/usr/openv/netbackup/bin/admincmd/bpmedialist -ev $evid -l|") || die "Could not run: bpmedialist -ev $evid -l : $!";
while() {
($id, $j1, $j2, $j3, $time_alloc, $last_update, $expire, $j4) =
split(/\s+/,$_,8);
if( $evid eq $id ) {
if( $now > $expire ) {
push(@return,$evid);
}
}
}
close(PIPE);
}

if( defined(@eject) ) {
open(PIPE, "|/usr/lib/sendmail -t") || die "Could not run sendmail for eject\n$!";
print PIPE "To: $operator\n";
printf PIPE "%s %d %s","Subject: OffSite Tape Vault:", scalar(@eject), "Tape(s)\n";
print PIPE "\n\n";
print PIPE "Eject the following tapes from the C2 Autoloader and send to the Offsite storage:\n\n";
foreach $evid (@eject) {
print PIPE "\t$evid\n";
}
print PIPE "\n\n";
print PIPE "Detailed Tape Information:\n";
foreach $evid (@eject) {
print PIPE `/usr/openv/netbackup/bin/admincmd/bpmedialist -ev $evid`;
}
close(PIPE);

} else {
$no_tapes_to_eject++;
}

if( defined(@return) ) {
open(PIPE, "|/usr/lib/sendmail -t") || die "Could not run sendmail for return\n$!";
print PIPE "To: $courier\n";
printf PIPE "%s %d %s","Subject: OffSite Tape Retrieval:", scalar(@return), "Tape(s)\n";
print PIPE "\n\n";
print PIPE "Return the following tapes from the OffSite Storage:\n\n";
foreach $evid (@return) {
print PIPE "\t$evid\n";
}
print PIPE "\n";
close(PIPE);
} elsif( defined($no_tapes_to_eject) ) {
open(PIPE, "|/usr/lib/sendmail -t") || die "Could not run sendmail for notice\n$!";
print PIPE "To: $courier\n";
print PIPE "CC: $operator\n";
print PIPE "Subject: OffSite Tape Maintenance: no action needed\n";
print PIPE "\n\n";
print PIPE "No actions needed this week\n\n";
close(PIPE);
}

----------------------------------------------------------------------------------

Fixed the package problem by removing the ld.config file reverting to the default system library path, probably changed via crle to build php.

Fixed the jpeg/gd/php image resize problem by linking the libjpeg8 libraries to the libjpeg62 libraries so that php and gd were getting the same library regardless of what was called

keep_jobs_hours in bp.conf to set number of hours of job activity shown in netbackup monitor

disable svc:/application/graphical-login/cde-login:default to stop graphical console

No comments: