Bacula-users

Re: [Bacula-users] Bacula 5.2.13 ClientRunAfterJob

2015-03-21 15:34:04
Subject: Re: [Bacula-users] Bacula 5.2.13 ClientRunAfterJob
From: Kern Sibbald <kern AT sibbald DOT com>
To: Peter Wood <peterwood.sd AT gmail DOT com>, "Ana Emília M. Arruda" <emiliaarruda AT gmail DOT com>
Date: Sat, 21 Mar 2015 09:28:10 -1000
Hello,

Bacula does not run a shell when it executes a "command" as you are doing.  Consequently shell characters such as * will be treated as themselves rather than shell characters (in this case a wild card).  This is because such interpretation is done by the shell.  So the solution is to either prefix the command with a call to a shell (lots of escaping to do) or *much* simpler, run the command in a shell script that you execute.  If I am not mistaken, there are nice examples in the manual.  Obviously (I hope), if you can be more specific and avoid wild cards you will not need a shell command prefix or a script.  I am not patient enough to work out all the escaping to pass shell characters correctly to the shell, so I always use a script when doing complicated stuff.

Best regards,
Kern

On 15-03-19 06:54 AM, Peter Wood wrote:
Thank you for the reply.

Yes, I've done all the debug steps I can think of.

Permissions is a good point though. The file permissions are 600 root:root. Only root can remove the file.

Bacula-fd process runs as root so I'm expecting it will be able to remove the file, right?

SELinux is disabled.


On Thu, Mar 19, 2015 at 4:39 AM, Ana Emília M. Arruda <emiliaarruda AT gmail DOT com> wrote:
Hi Peter,

Have you checked if the job falis or not? The Client Run After Jog do not runs if the job falis. You can use the bellow if you want that the script runs despite of the job falis or not:

Run Script {
  RunsWhen = After
  RunsOnFailure = yes
  Commnad =  "/bin/rm -f /backup/daily/mysql-Slave*"
}

Have you tried to run the command at the commnad line? Have you checked permissions? Have you checked any messages at Bacula's log file? Is the mysqldump generating the file at /backup/daily/? 

Best regards,
Ana

On Wed, Mar 18, 2015 at 11:54 PM, Peter Wood <peterwood.sd AT gmail DOT com> wrote:
In Bacula 5.2.13 I use

Client Run Before Job = "mysqldump ...." 

to dump the database before the backup starts.

After it is complete I use

Client Run After Job = "/bin/rm -f /backup/daily/mysql-Slave*"

with the intend to remove the backup file due to lack of free space to keep more then one backup.

The backup report shows that it ran the command:
18-Mar 09:39 db1-fd JobId 12980: shell command: run ClientAfterJob "/bin/rm -f /backup/daily/mysql-Slave*"

Unfortunately the file is not removed.

Any idea? Is it the use of wildcard?

Thanks,

-- Peter

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users





------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/


_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users