-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Arno Lehmann wrote:
> 30.10.2008 04:47, Dan Langille wrote:
>> SZÉKELYI Szabolcs wrote:
>>> -----BEGIN PGP SIGNED MESSAGE-----
>>> Hash: SHA1
>>>
>>> Hi,
>>>
>>> the ability to use FIFOs to produce the data to be backed up is a nice
>>> feature of Bacula, however, I don't really understand how this can work
>>> reliably.
>>>
>>> I understand the concept, but I have problems with timing. I did a small
>>> research on how FIFOs work. Consider the following script:
>>>
>>> ==
>>> #!/bin/bash
>>>
>>> exec > /dev/null
>>>
>>> mkfifo /tmp/tmpfifo
>>>
>>> (
>>> for n in `seq 20`; do
>>> echo $n >/tmp/tmpfifo
>>> sleep 1
>>> done
>>> ) &
>>> ==
>>>
>>> Let's use this script to generate the data to be backed up, so it is run
>>> from RunBeforeJob. Creates a FIFO, writes the numbers from 1 to 20 into
>>> it, with a 1 second delay between them.
>
> You need to be aware that your loop does the following:
> 1. open the FIFO for writing
> 2. write into it
> 3. close the FIFO
> 4. sleep
> 5. loop
>
> The important thing is that the FIFO is opened and closed for each write.
>
> If, on the other hand, you opened the FIFO in the surrounding code,
> redirected your output to it (for testing, do it similarly as you do
> with 'exec > /dev/null') and closed the FIFO once the loop is done
> you'll see your cat reads all the numbers in one go.
>
> That's the difference.
That's a point. I see now. Thanks.
- --
cc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
iEYEARECAAYFAkkJo8sACgkQGJRwVVqzMkORUACgiND8HSt62kZ76vTvgNTXb6R8
MLYAniBfNH3Ak8yzwveMjJagHXpjly5T
=IqCK
-----END PGP SIGNATURE-----
-------------------------------------------------------------------------
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
|