N
Nix!
Hi everyone,
I have a tape autoloader with 8 tapes. The tapes are labeled monday,
tues, wed, thurs, friday 1, friday 2, friday 3, and friday 4.
My backup script needs to be modified to load the correct tape each
friday. A copy of the existing script can be found here:
http://bobotheclown.org/scripts/compperl
Here is the code I have written so far:
#!/usr/bin/perl
use strict;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
my $tapenumber = --$wday;
my $filename = "/backup/scripts/week_of_month";
if ($wday == 5) {
open FH15,'+<', $filename or die "Could not open $filename: $!\n";
my @weeknumber = <FH15>;
}
my $loadtape = "mtx -f /dev/sg17 load $tapenumber";
print "$loadtape\n";
my $unloadtape = "mtx -f /dev/sg17 unload $tapenumber";
print "$unloadtape\n";
I am presently planning to incriment the week number in a txt file
until it reaches 4 and then start over. This seems fail to me. The
text file may be deleted, and the rotation will be lost. It is also a
lot of code to write.
Can anyone suggest a more intelligent alternative for finding the 1st,
2nd, 3rd, and 4th friday relative to the first time the script ever
ran?
I have a tape autoloader with 8 tapes. The tapes are labeled monday,
tues, wed, thurs, friday 1, friday 2, friday 3, and friday 4.
My backup script needs to be modified to load the correct tape each
friday. A copy of the existing script can be found here:
http://bobotheclown.org/scripts/compperl
Here is the code I have written so far:
#!/usr/bin/perl
use strict;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
my $tapenumber = --$wday;
my $filename = "/backup/scripts/week_of_month";
if ($wday == 5) {
open FH15,'+<', $filename or die "Could not open $filename: $!\n";
my @weeknumber = <FH15>;
}
my $loadtape = "mtx -f /dev/sg17 load $tapenumber";
print "$loadtape\n";
my $unloadtape = "mtx -f /dev/sg17 unload $tapenumber";
print "$unloadtape\n";
I am presently planning to incriment the week number in a txt file
until it reaches 4 and then start over. This seems fail to me. The
text file may be deleted, and the rotation will be lost. It is also a
lot of code to write.
Can anyone suggest a more intelligent alternative for finding the 1st,
2nd, 3rd, and 4th friday relative to the first time the script ever
ran?