Bacula-users

Re: [Bacula-users] [Bacula-devel] bconsole scripting

2010-05-28 08:07:14
Subject: Re: [Bacula-users] [Bacula-devel] bconsole scripting
From: Olaf Zevenboom <olaf AT artefact DOT nl>
To: bacula-users <bacula-users AT lists.sourceforge DOT net>, bacula-devel AT lists.sourceforge DOT net
Date: Fri, 28 May 2010 14:03:42 +0200
Kern Sibbald wrote:
> On Thursday 27 May 2010 17:23:46 Morty Abzug wrote:
>   
>> On Tue, May 25, 2010 at 05:01:52PM +0200, Kern Sibbald wrote:
>>     
>>> I don't think there is any need for either a -e option nor a -b option. 
>>> Both can easily be done via the shell.
>>>       
>>  -e can indeed easily be done from the shell.  But the caller isn't
>> always a shell environment.  It's usually possible to workaround this,
>> of course, with something like sh -c "echo mount | bconsole"; -e would
>> just make this easier.
>>
>>  -b cannot easily be done by the shell.  The intent is to remove
>> formatting done for human convenience.
>>     
>
> I have been doing *lots* of scripting of bconsole for 8 years no with no 
> problems, so I really don't understand the problem.
>
> What do you mean by "remove formatting done for human convenience"?
>   

Not sure what *he* means but I can guess: mysql has various options to 
call mysql without formatting  output or with a special way of 
formatting output when used from commandline/script. To relate this to 
Bacula: list media  scripted through bconsole: echo "list media" | bconsole
This produces a list of media formatted in an ascii-table with columns, 
fields etc marked up by "+" ,"-" and "|" characters.
Comparing this to mysql again: mysql allows the removal of 
column/field-names and other layouting. bconsole does not. (see man mysql)
This results in the need of getting rid of those from within the script. 
Fine if you are using perl, python, php etc but a bit more troublesome 
if you are scripting in Bash. (cut, grep, awk, sed can help of course). 
So the point being: bconsole's output must be stripped on every occasion 
which leads to more coding in scripts. Depending on the scripting 
language this is hard or easy but needed nevertheless.

Olaf


------------------------------------------------------------------------------

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