Bacula-users

Re: [Bacula-users] RunBeforeJob in background

2008-11-11 14:44:14
Subject: Re: [Bacula-users] RunBeforeJob in background
From: Arno Lehmann <al AT its-lehmann DOT de>
To: bacula-users AT lists.sourceforge DOT net
Date: Tue, 11 Nov 2008 20:40:46 +0100
Hi,

11.11.2008 11:34, Ronald Buder wrote:
> Arno Lehmann wrote:
>> Hi,
>>
>> 06.11.2008 11:32, Isabel Bermejo wrote:
>>  
>>> Hi all,
>>>
>>> I'm trying to backup a MySQL database and in the Job Resource I 
>>> define the
>>> command RunBeforeJob with a script that dumps the database to a fifo 
>>> file. I
>>> need to run both at the same time, I mean I want to run the script while
>>> bacula runs the job. With RunBeforeJob, first dumps the database and 
>>> then
>>> starts the backup of a file. Does anyone know how to run a script in
>>> background using RunBeforeJob to perform the dump and the backup job 
>>> run at
>>> the same time?
>>>     
>>
>> The solution to that is to start the MySQL dump in the background. In 
>> your run before job script, you'd create (or make sure it's useable) 
>> the FIFO, then start mysqldump with an "&" at the end of the command 
>> line. That sends the mysqldump to the background - you'll probably 
>> need to detach from stdin, stdout and stderr first as these file 
>> handles, when kept open, can prevent Bacula from going further.
>>
>> I believe I pointed you to a wiki page where a collection of sample 
>> scripts is presented which backs up PostgreSQL in that fashion - 
>> adapting those to MySQL should be possible without changing the stuff 
>> around the actual database interface.
>>
>> Arno
>>
>>  
>>> Thank you
>>> ISABEL
>>>     
> The "&" is one way of doing it. I suspect a careful "nohup" would do 
> just the same. 

nohup still needs the "&" (at least on all unices I know).

> For some instances I even use screen to work around 
> parallel processes, not only for Bacula issues.

screen can indeed be a nice solution, especially during development as 
you could attach to it and see the progress while the dump runs. 
Interesting possibility.

> You _could_ even start a second job, an admin job for instance that 
> takes care of the dumping.
> 
> A carefully placed "echo \"run job=\"TheJobName\" yes | bconsole\"" will 
> work wonders.

Yes, but that relies on the job execution order to be predictable, 
which need not be the case with different priorities and so on, so I'd 
be careful with this approach.

One other solution: For saving cyrus mailboxes, I create the dump of 
the mboxlist during the file system creation, which is done in a 
script. That's closely tied to the job execution, definitely runs 
before the job itself is started, and doesn't require a "Run Before 
Job" script, which, for several reasons, I want to avoid in this case.

> Hope that helps,

Hopefully... Isabel, any results to report?

Arno

> 
> regards...
> 

-- 
Arno Lehmann
IT-Service Lehmann
Sandstr. 6, 49080 Osnabrück
www.its-lehmann.de

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>