#
#========================================================================
#
-# Version 3.0.0alpha, released 23 Jan 2006.
+# Version 3.0.0, released 28 Jan 2007.
#
# See http://backuppc.sourceforge.net.
#
# Read old status
#
if ( -f "$LogDir/status.pl" && !(my $ret = do "$LogDir/status.pl") ) {
- die "couldn't parse $LogDir/status.pl: $@" if $@;
- die "couldn't do $LogDir/status.pl: $!" unless defined $ret;
- die "couldn't run $LogDir/status.pl";
+ if ( $@ ) {
+ print STDERR "couldn't parse $LogDir/status.pl: $@";
+ } elsif ( !defined($ret) ) {
+ print STDERR "couldn't do $LogDir/status.pl: $!";
+ } else {
+ print STDERR "couldn't run $LogDir/status.pl";
+ }
}
#
# Write out our initial status and save our PID
#
StatusWrite();
+ unlink("$LogDir/BackupPC.pid");
if ( open(PID, ">", "$LogDir/BackupPC.pid") ) {
print(PID $$);
close(PID);
+ chmod(0444, "$LogDir/BackupPC.pid");
}
#
});
$CmdQueueOn{$bpc->trashJob} = 1;
}
- if ( keys(%Jobs) == $trashCleanRunning && $RunNightlyWhenIdle == 1 ) {
+ if ( $RunNightlyWhenIdle == 1 ) {
#
# Queue multiple nightly jobs based on the configuration
}
}
- while ( $RunNightlyWhenIdle == 0 ) {
+ #
+ # Run background jobs anytime. Previously they were locked out
+ # when BackupPC_nightly was running or pending with this
+ # condition on the while loop:
+ #
+ # while ( $RunNightlyWhenIdle == 0 )
+ #
+ while ( 1 ) {
local(*FH);
my(@args, $progName, $type);
my $nJobs = keys(%Jobs);
$Conf{CompressLevel}, 1);
LogFileOpen();
#
- # Remember to run nightly script after current jobs are done
+ # Remember to run the nightly script when the next CmdQueue
+ # job is done.
#
$RunNightlyWhenIdle = 1;
}
#
# This means the last BackupPC_nightly is done with
# the pool clean, so it's ok to start running regular
- # backups again.
+ # backups again. But starting in 3.0 regular jobs
+ # are decoupled from BackupPC_nightly.
#
$RunNightlyWhenIdle = 0;
}
#print(LOG $bpc->timeStamp, "BackupPC_nightly done; now"
# . " have $BackupPCNightlyJobs running\n");
if ( $BackupPCNightlyJobs <= 0 ) {
+ #
+ # Last BackupPC_nightly has finished
+ #
$BackupPCNightlyJobs = 0;
$RunNightlyWhenIdle = 0;
$CmdJob = "";