Bacula-users

Re: [Bacula-users] Runafterjob issue

2012-10-04 03:52:09
Subject: Re: [Bacula-users] Runafterjob issue
From: Konstantin Khomoutov <flatworm AT users.sourceforge DOT net>
To: Wouter van Marle <wouter AT squirrel-systems DOT com>
Date: Thu, 4 Oct 2012 11:49:01 +0400
On Thu, Oct 04, 2012 at 12:38:44PM +0800, Wouter van Marle wrote:

[...]
> RunAfterJob = "echo '/usr/local/bin/glacier-cmd --logtostdout upload
> Squirrel_backup %v' | batch"
> 
> Running this command (replacing the %v with an actual file name of
> course) from the command line works fine. The process is scheduled by
> batch to run as soon as system load allows (usually instantly) and it's
> running in the background, sending output to user bacula which
> ultimately ends up in my mail box.
> 
> But running from Bacula fails. In the result e-mailed to me when the job
> is finished I see this:
> 
> 04-Oct 05:05 acorn.squirrel-dir JobId 34:
> AfterJob: /usr/local/bin/glacier-cmd --logtostdout upload
> Squirrel_backup Squirrel-BackupCatalog.2012-10-04_05.05.00_04 | batch
> 
> The `echo` part is gone, and it didn't run.
> 
> An obvious hack would be to create a shell script that is called by
> Bacula and that in turn starts the upload, but that shouldn't be
> necessary.

This is a typical problem: the string to execute is not passed through
any shell but rather executed directly, so in your case the OS probably
finds /bin/echo and passes it three arguments,
"/usr/local/bin/glacier-cmd ... 00-04", "|" and "batch", which echo
happily prints to its stdout and exits successfully.

To not mess with writing the real shell script, consider embedding a
call to the shell to your script string, like this:

RunAfterJob = "/bin/sh -c \"/that/cmd ... '%v' | batch\""


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
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>