X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=bin%2FBackupPC;h=786ecbaa87dbea33cc47c6ba6167ca0d86948ab6;hb=31a7aca27ffd75e0aee9836704599cdb95dc2421;hp=f4e4af7bbe431ac4858835392426c097ec2f64b6;hpb=5b3e6091d542c2e7445d5dd511cdf6e20aec8b8d;p=BackupPC.git diff --git a/bin/BackupPC b/bin/BackupPC index f4e4af7..786ecba 100755 --- a/bin/BackupPC +++ b/bin/BackupPC @@ -47,7 +47,7 @@ # #======================================================================== # -# Version 3.0.0alpha, released 23 Jan 2006. +# Version 3.0.0beta2, released 18 Nov 2006. # # See http://backuppc.sourceforge.net. # @@ -113,9 +113,13 @@ if ( $Conf{BackupPCUserVerify} # 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"; + } } # @@ -345,9 +349,11 @@ sub Main_Initialize # 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"); } # @@ -388,7 +394,7 @@ sub Main_TryToRun_nightly }); $CmdQueueOn{$bpc->trashJob} = 1; } - if ( keys(%Jobs) == $trashCleanRunning && $RunNightlyWhenIdle == 1 ) { + if ( $RunNightlyWhenIdle == 1 ) { # # Queue multiple nightly jobs based on the configuration @@ -606,7 +612,14 @@ sub Main_TryToRun_Bg_or_User_Queue } } - 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); @@ -836,7 +849,8 @@ sub Main_Check_Timeout $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; } @@ -1067,7 +1081,8 @@ sub Main_Check_Job_Messages # # 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; } @@ -1097,6 +1112,9 @@ sub Main_Check_Job_Messages #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 = "";