#
#========================================================================
#
-# Version 2.1.0beta1, released 9 Apr 2004.
+# Version 2.1.0, released 20 Jun 2004.
#
# See http://backuppc.sourceforge.net.
#
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 = ();
}
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;
}
}
+#
+# 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
#
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 );