Bacula-users

Re: [Bacula-users] Files are added to catalog at the end of backup

2017-02-02 08:40:54
Subject: Re: [Bacula-users] Files are added to catalog at the end of backup
From: Kern Sibbald <kern AT sibbald DOT com>
To: Daniel Heitepriem <daniel.heitepriem AT pribas DOT com>, "bacula-users AT lists.sourceforge DOT net" <bacula-users AT lists.sourceforge DOT net>
Date: Thu, 2 Feb 2017 14:39:36 +0100
Hello,

When a Bacula backup job terminates, all the File table entries are 
already in the catalog.  So about the only thing that makes any sense is 
that you are running the script before the backup completes.  Perhaps by 
simply adding a
"wait" just before your llist, would solve the problem.  However, be 
aware "wait" waits until no jobs are running which may delay the output 
if you are running multiple jobs.  There is a "wait JobId=nnn" but I am 
not 100% sure it really works correctly (I have a vague recollection of 
some problems).

Alternatively, it seems to me that use the appropriate RunScript + 
options to do the work, you can guarantee that it runs at the end of the 
job.

Best regards,
Kern

On 02/02/2017 09:57 AM, Daniel Heitepriem wrote:
> Hi guys,
>
> I'm using Bacula 7.4.4 and got a script which runs after every backup
> and expects a list of file names which were backed up. Now I noticed
> that bacula is writing the files to the Catalog at the end of the backup
> process, thus the script receives an empty list and doesn't run
> properly. Below I got an excerpt of this script:
>
> export HOME; HOME="/opt/bacula"
> export LOG; LOG="$HOME/var/cleanup.$1.log"
>
> echo "Cleaning job $1">>$LOG
>
> $HOME/bin/bconsole <<EOF
> @output /dev/null
> messages
> @output $HOME/var/cleanup.$1.set
> llist files jobid="$1"
> EOF
>
>
> for file in $( egrep "^\|" $HOME/var/cleanup.$1.set | sed -e "s/\|//g" )
> do
>     if [ $file != "Filename" ]
>     then
>       AGE=$(perl -e  "print (-M \"$file\");"|cut -d'.' -f1) ## Get age of
> file
>
>       if test -d $file ; then ## If line is  a directory
>         echo "Directory $file ... skipping...">>$LOG
>       elif echo $file|egrep '.gz$' 2>&1 >/dev/null ; then ## Test if file
> has ".gz" suffix
>         if [ "$AGE" -gt "$KEEP" ] ; then
>           echo "$file is older than $KEEP days -> removing">>$LOG
>           pfexec rm $file  ## Removing files older than 7 days
>         else
>           echo "$file is younger than $KEEP days -> keeping">>$LOG
>
> In Bacula 5 this issue isn't present so the file list is available
> almost instantly. Did something change between the versions regarding
> this behavior?
>
> Thanks and best regards,
> Daniel Heitepriem
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
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>