Direkt zum Inhalt

Fix for incremental/differential purging bug in ATI2011/2010 - Perl pre-command script

Thread needs solution

ATI Home 2010 and 2011 have never really worked correctly in terms of the purging logic and the specification of so many days until a new full backup is performed. There was a DOS bat file that Acronis support put up a while back, but that did not seem to work either. The simple answer...

So, if you have perl on your system (I recommend the ActiveState distribution http://www.activestate.com/ ) this script will clean out the TIB folder on specified day of the week, thereby forcing a full backup to commence. Run it as a 'pre-command' . In the example invocation below, it will clean out the .tib files on sundays. This is not fancy, and there are plenty of opportunities for someone to embellish this (version folders, space checks, first run of day, etc).

BATCH File for command:
c:\Perl64\bin\perl.exe c:\batch\ATI_Cleaner.pl -f D: -d sunday -l D:\logs

#=========== PERL SCRIPT STARTS HERE ===========
use DateTime;
use DateTime::Util::DayOfWeek;
use vars qw/ %opt /;

##
# Command line options processing
#
sub init()
{
use Getopt::Std;
my $opt_string = 'f:d:l:';
getopts( "$opt_string", \%opt ) or usage();
usage() if $opt{h};
}

#
# Message about this program and how to use it
#

sub usage() {
print STDERR << "EOF";
Deletes Acronis .tib files on a specified day of the week prior to backup job.
-f Folder path to the backup file (e.g. F:\Backups)
-d Day of weeek to clean out the files; e.g. sunday monday tuesday etc.
-l Log the actions in ATI_Cleaner.log file in this directory

EOF
exit;
}

&init;

my $dt = DateTime->now;
$dt->set_time_zone( 'local' );

$dmy = $dt->dmy;
$hms = $dt->hms;
$todayName = $dt->day_name;
$timeStamp = "$dmy $hms";
$TIB_FOLDER = $opt{f};
$doDelete = ($todayName =~ /$opt{d}/i);
$logName = "$opt{l}" . "\\ATI_Cleaner.log";
open(L, ">>$logName");

if ($doDelete) {
# delete the .tib files in the backup location
my $cmd = "del $TIB_FOLDER\\*.tib";
print $cmd,"\n";
system("$cmd");
print L "$timeStamp:Today is $todayName, so we deleted the backups in $TIB_FOLDER before backup operation.\n";
close(L);
exit 0;
}
print L "$timeStamp:Today is $todayName, not $opt{d} so nothing was done before the backup.\n";
close(L);
exit 0;

0 Users found this helpful