The way we have dealt with this issue is to schedule backup jobs
through cron and a simple Perl script. We run full backups on
Saturdays, with the last Saturday of the month being an offsite which
is maintained for a year, normal fulls are maintained for two months.
Each day other than Saturday we run an incremental.
The cron job looks like this:
0 23 * * * /usr/openv/local/runbackup.pl odin-vol0
And the perl script:
#!/home/std/bin/perl5
# this script is tailored to run Netbackup backups for Odin
# the existance of this script is due to deficiencies in the Netbackup
# job scheduler.
# Given a NetBackup class name:
# on the last Saturday of the month, run an offsite
# on other Saturday's run a full
# otherwise run an incremental
#
# Assumptions:
# offsite schedule is "offsite", full schedule is "full", incremental - "inc"
# arguments: NetBackup_Class_Name
# Written by Chris Graves 3/23/00
require 'ctime.pl';
$class = $ARGV[0];
# determine the current time, specifically the day and month
$timenow = time;
#$timenow+= (60*60*24*26); # used for testing
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($timenow);
# add a week to the current time
$timeplusweek=$timenow + (60 * 60 * 24 * 7);
($nsec,$nmin,$nhour,$nmday,$nmon,$nyear,$nwday,$nyday,$nisdst) = localtime($time
plusweek);
# see if next week same day is a new month
if ($mon == $nmon) {
#not last xday of month
$lastXdayOfMonth=0;
} else {
#last xday of month
$lastXdayOfMonth=1;
}
# determine schedule - assume inc and change as appropriate
$schedule = "inc";
$saturday = 6;
if ($wday == $saturday) {
$schedule = "full";
$schedule = "offsite" if $lastXdayOfMonth;
}
$command = join "", "/usr/openv/netbackup/bin/bpbackup ",
"-i -c $class -s $schedule -k \"$class $schedule ",
$mon + 1 , "/" , $mday , "/" , 1900 + $year , "\"";
#print("$command\n");
system($command);
|