Bacula-users

Re: [Bacula-users] duplicate full backups

2008-04-29 06:16:31
Subject: Re: [Bacula-users] duplicate full backups
From: Silver Salonen <silver AT ultrasoft DOT ee>
To: bacula-users AT lists.sourceforge DOT net
Date: Tue, 29 Apr 2008 13:16:09 +0300
On Tuesday 22 April 2008 13:20, Arno Lehmann wrote:
> 22.04.2008 11:37, Silver Salonen wrote:
> > On Monday 07 April 2008 16:22, Arno Lehmann wrote:
> >> 07.04.2008 15:05, Silver Salonen wrote:
> >>> On Monday 07 April 2008 10:37, Arno Lehmann wrote:
> >>>> 07.04.2008 06:04, Seth Miller wrote:
> >>>>> How can I force Bacula to complete a job before it starts a new one
> >>>>> for the same client?
> >>>> You can't, now, I believe.
> >>> But you can automatically cancel the incremental job that would be 
> > upgraded to 
> >>> duplicate full. I'm doing it with:
> >>>
> >>> JobDefs {
> >>>         ...
> >>>         Max Wait Time = 12h
> >>> }
> >>>
> >> Well, if you're using that approach, and usually have jobs run 
> >> concurrently (so normally the jobs don't have to wait at all) I'd set 
> >> the wait time rather low, like 5 minutes. Otherwise, if a job takes 35 
> >> hours, you'll end up with another full backup...
> >>
> >> Also, the "Incremental Max Wait Time" seems to be broken... at least 
> >> that's what I read on -devel by Eric Bollengier.
> > 
> > Actually yes, right you are, that's not a solution. Especially as the "Max 
> > Wait Time" causes the running backups to be cancelled after the specified 
> > time (I complained about this in a separate thread).
> > 
> > Right now it came to me that the same check could be done with "run before 
> > job" script. A quick example (check-job.sh):
> > =====
> > jobName="$1"
> > jobId="$2"
> > if ( echo "status dir" | bconsole | grep -v "${jobId}" | grep "Job 
> > ${jobName}.* is running" ); then
> >         exit 1
> > else
> >         exit 0
> > fi
> > =====
> > The script should be ran with "Run Before Job = check-job.sh '%n' '%i'".
> > 
> > Some notes after testing that solution:
> > * the same job must be able to run concurrently, because "run before job" 
is 
> > executed before starting backup, not when the job is scheduled
> > * user of bacula-dir (running process) must be able to access 
bconsole.conf
> > * the "Run Before Job" may be used next to other "run script" directives
> > 
> > Any thoughts on that approach?
> 
> For now, this looks like a good solution. The prerequisites should be 
> easy to satisfy... the only thing I'd do is elimintae one pipe through 
> grep by using a more complex regex as the search pattern. But that's 
> not essential. You could even save the if... then... else... fi clause 
> if you inverted the search :-)
> 
> I at least like this approach!

Hmm, I wonder where did I take the "Job ${jobName}". A little more precise 
grep would be:

if ( echo "status dir" | bconsole | grep -v "^ *${jobId}" | grep "${jobName}\.
[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}.*is running" ); then

This should be quite enough :)

--
Silver

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users