On Oct 30, 2008, at 9:48 AM, Shad L. Lords wrote: > Arno Lehmann wrote: >> 30.10.2008 04:47, Dan Langille wrote: >>> SZÉKELYI Szabolcs wrote: >>>> 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. > > This was going to be my point as well. Take your example and change > it > to this and everything behaves as you expect: > > #!/bin/bash > > exec > /dev/null > > mkfifo /tmp/tmpfifo > > ( > for n in `seq 20`; do > echo $n > sleep 1 > done > ) >/tmp/tmpfifo &
Nice. Thank you I hope the original poster replies back with test results from a Bacula job. -- Dan Langille http://langille.org/ ------------------------------------------------------------------------- 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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users