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@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users