X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_archive;h=ad10f1fca205315d5879d093321ac885868bb105;hp=e1e99005bb8b8d02c9aa6ff9710369bf30b22a62;hb=refs%2Ftags%2Fv3_0_0beta1;hpb=617af75f7419e95a9c3ea05b05cf21957acc331c diff --git a/bin/BackupPC_archive b/bin/BackupPC_archive index e1e9900..ad10f1f 100644 --- a/bin/BackupPC_archive +++ b/bin/BackupPC_archive @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0alpha, released 23 Jan 2006. +# Version 3.0.0beta1, released 30 Jul 2006. # # See http://backuppc.sourceforge.net. # @@ -91,9 +91,30 @@ mkpath($Dir, 0, 0777) if ( !-d $Dir ); if ( !-f "$Dir/LOCK" ) { open(LOCK, ">", "$Dir/LOCK") && close(LOCK); } -open(LOG, ">>", "$Dir/LOG"); -select(LOG); $| = 1; select(STDOUT); +my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +my $logPath = sprintf("$Dir/LOG.%02d%04d", $mon + 1, $year + 1900); + +if ( !-f $logPath ) { + # + # Compress and prune old log files + # + my $lastLog = $Conf{MaxOldPerPCLogFiles} - 1; + foreach my $file ( $bpc->sortedPCLogFiles($client) ) { + if ( $lastLog <= 0 ) { + unlink($file); + next; + } + $lastLog--; + next if ( $file =~ /\.z$/ || !$Conf{CompressLevel} ); + BackupPC::FileZIO->compressCopy($file, + "$file.z", + undef, + $Conf{CompressLevel}, 1); + } +} +open(LOG, ">>", $logPath); +select(LOG); $| = 1; select(STDOUT); # # Read the request file