Bacula-users

Re: [Bacula-users] Runafterjob issue

2012-10-04 09:54:09
Subject: Re: [Bacula-users] Runafterjob issue
From: Wouter van Marle <wouter AT squirrel-systems DOT com>
To: Konstantin Khomoutov <flatworm AT users.sourceforge DOT net>
Date: Thu, 04 Oct 2012 21:51:22 +0800
Related issues I just ran into improving my script.


The RunAfterJob now reads (one line):
RunAfterJob = "/bin/sh -c \"echo '/usr/local/bin/glacier-cmd --logtostdout 
upload Squirrel_backup %v \\\"%j (%l, since %s)\\\" ' | batch\""


Which results in these messages (two lines):
> 04-Oct 21:43 acorn.squirrel-dir JobId 44: shell command: run AfterJob 
> "/bin/sh -c "echo '/usr/local/bin/glacier-cmd --logtostdout upload 
> Squirrel_backup  \"Users.2012-10-04_21.43.17_03 (Incremental, since 
> 2012-10-04 21:38:58)\" ' | batch""
> 04-Oct 21:43 acorn.squirrel-dir JobId 44: AfterJob: 
> Users.2012-10-04_21.43.17_03: -c: line 0: unexpected EOF while looking for 
> matching `''

But when run from the command prompt, the command works just fine (one
line):
$ /bin/sh -c "echo '/usr/local/bin/glacier-cmd --logtostdout upload 
Squirrel_backup  \"Users.2012-10-04_21.43.17_03 (Incremental, since 2012-10-04 
21:38:58)\" ' | batch"


And the %v translation does not work properly (the whole %-translation
thing seems to be hit and miss, I had several more issues when trying to
get some sample outputs and so).
When I put '/backup/bacula/%v' in the script, it does NOT replace the %v
with the actual file name. Without the path, it does the replacement.
But I need the path for the command to actually work!

It seems that going for a second script is the only way out here :-(


And I'll think of some improvement of the docs. Adding an example will
probably do the job, both by clarifying the issue and by giving it more
focus.


Wouter.

On Thu, 2012-10-04 at 17:40 +0400, Konstantin Khomoutov wrote:
> On Thu, 04 Oct 2012 20:44:33 +0800
> Wouter van Marle <wouter AT squirrel-systems DOT com> wrote:
> 
> > > 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\""
> > > 
> > > 
> 
> > That works, thanks for the quick reply!
> > 
> > Would be nice to have this mentioned in the docs, if it's there I
> > totally missed it.
> > 
> > Writing a real script is of course easy, it's just messy and harder to
> > see what's going on if I revisit this which may be years from now.
> 
> http://bit.ly/O7z6SU reads this:
> 
> "In addition, the command string is parsed then fed to the OS, which
> means that the path will be searched to execute your specified command,
> but there is no shell interpretation, as a consequence, if you invoke
> complicated commands or want any shell features such as redirection or
> piping, you must call a shell script and do it inside that script."
> 
> I would say the wording is imperfect.
> If you can propose a better one, feel free to file a feature request
> with http://bugs.bacula.org/
> 
> 



------------------------------------------------------------------------------
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>