X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC_archive;h=5cca3f350272c04d9ee16a745e25e4333327fc98;hp=969590646d00c76e3c37eef149610b3174757883;hb=82ffaa1c4130a34812fb241c2ea5cd3d0608bdab;hpb=4cdaa6b8a9f5161ee2da4371d68cbbad41248ea0 diff --git a/bin/BackupPC_archive b/bin/BackupPC_archive index 9695906..5cca3f3 100644 --- a/bin/BackupPC_archive +++ b/bin/BackupPC_archive @@ -11,7 +11,7 @@ # Josh Marshall # # COPYRIGHT -# Copyright (C) 2001-2004 Craig Barratt +# Copyright (C) 2001-2007 Craig Barratt # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 3.0.0beta0, released 11 Jul 2006. +# Version 3.1.0beta0, released 3 Sep 2007. # # 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