X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=bin%2FBackupPC;h=50d55009c87bdc4e1840f823eba9259d700527a1;hp=585eec15439924fbf1b9a9ea9cb3f79c97713041;hb=e951f787a66c5bd9e9955c3f657a5b44289c0fe1;hpb=5c6a6cc4f333ce44a9df62ab828b0b9341579f7c;ds=sidebyside diff --git a/bin/BackupPC b/bin/BackupPC index 585eec1..50d5500 100755 --- a/bin/BackupPC +++ b/bin/BackupPC @@ -47,7 +47,7 @@ # #======================================================================== # -# Version 2.1.0beta1, released 9 Apr 2004. +# Version 2.1.0, released 20 Jun 2004. # # See http://backuppc.sourceforge.net. # @@ -596,7 +596,7 @@ sub Main_TryToRun_Bg_or_User_Queue if ( $du > $Conf{DfMaxUsagePct} ) { my $nSkip = @BgQueue + @deferBgQueue; print(LOG $bpc->timeStamp, - "Disk too full ($du%%); skipping $nSkip hosts\n"); + "Disk too full ($du%); skipping $nSkip hosts\n"); $Info{DUDailySkipHostCnt} += $nSkip; @BgQueue = (); @deferBgQueue = (); @@ -782,6 +782,8 @@ sub Main_Check_Timeout } print(LOG $bpc->timeStamp, "Aging LOG files, LOG -> LOG.0 -> " . "LOG.1 -> ... -> LOG.$lastLog\n"); + close(STDERR); # dup of LOG + close(STDOUT); # dup of LOG close(LOG); for ( my $i = $lastLog - 1 ; $i >= 0 ; $i-- ) { my $j = $i + 1; @@ -1531,6 +1533,18 @@ sub StatusWrite } } +# +# Compare function for host sort. Hosts with errors go first, +# sorted with the oldest errors first. The remaining hosts +# are sorted so that those with the oldest backups go first. +# +sub HostSortCompare +{ + return -1 if ( $Status{$a}{error} ne "" && $Status{$b}{error} eq "" ); + return 1 if ( $Status{$a}{error} eq "" && $Status{$b}{error} ne "" ); + return $Status{$a}{endTime} <=> $Status{$b}{endTime}; +} + # # Queue all the hosts for backup. This means queuing all the fixed # ip hosts and all the dhcp address ranges. We also additionally @@ -1538,7 +1552,7 @@ sub StatusWrite # sub QueueAllPCs { - foreach my $host ( sort(keys(%$Hosts)) ) { + foreach my $host ( sort(HostSortCompare keys(%$Hosts)) ) { delete($Status{$host}{backoffTime}) if ( defined($Status{$host}{backoffTime}) && $Status{$host}{backoffTime} < time );