Bacula-users

Re: [Bacula-users] Feature idea feeler - bconsole "include / grep"

2010-05-10 19:59:26
Subject: Re: [Bacula-users] Feature idea feeler - bconsole "include / grep"
From: mark.bergman AT uphs.upenn DOT edu
To: bacula-users AT lists.sourceforge DOT net
Date: Mon, 10 May 2010 19:39:18 -0400

In the message dated: Mon, 10 May 2010 13:26:51 +1000,
The pithy ruminations from Norberto Meijome on 
<Re: [Bacula-users] Feature idea feeler - bconsole "include / grep"> were:

=> 
=> (and to the list.. Apologies Gavin for private reply...)
=> 
=> On 7 May 2010 19:19, Gavin McCullagh <gavin.mccullagh AT gcd DOT ie> wrote:
=> 
=> > On Thu, 06 May 2010, Steve Polyack wrote:
=> >

        [SNIP!]

=> > > bconsole session.  However, perhaps a solution would be to have bconsol=
=> e
=> > > parse the pipe character and feed output into the command that follows
=> > > which could be any arbitrary *nix command (as opposed to
=> > > writing/including our own version of grep).
=> >

I think that's a great suggestion, and the cleanest way to do this. I'd add one 
thing, which is to have bconsole detect ">" in a command as well. The logic 
would be (in bad pseudo-code):

        if [ bconsole_cmd =~ /|/ OR bconsole_cmd =~ />/ ]
                beforeredirect=[part of bconsole_cmd before redirection char]
                afterredirect=[part of bconsole_cmd after redirection char]
                
                if [ redirectchar = "|" ] then
                        echo $beforeredirect | bconsole | $afterredirect
                else
                        echo $beforeredirect | bconsole > $afterredirect
                fi
        else
                exec bconsole_command
        fi

=> > For comparison, the Postgresql and MySQL command line interfaces include
=> > something similar to this.
=> >
=> > MySQL offers the "pager" command which can be set to "less" or "grep xxxx=
=> ",
=> > etc. as well as the tee command to also send output to a file.  Postgresq=
=> l
=> > offers a single:
=> >
=> >          \o [FILE]      send all query results to file or |pipe
=> >
=> > Neither allow anything as simple as
=> >
=> >        SELECT ....... ; | grep blah
=> >
=> >
=> my $0.02,
=> 
=> Bconsole already performs SQL queries for all commands that would issue a
=> long listing, right?
=> 
=> SQL was meant for filtering & relating data ... Why not add some filter
=> param that is added to the SQL being sent to the backend? something like th=
=> e

That's great...if you already know SQL.

I'm guessing that most system administrators who are managing bacula are much 
more familiar with shell tools & paradigms than with SQL. I wish I knew SQL, 
but even more, I'd prefer to send the output of bconsole to tools that I 
already know (grep, perl, awk, etc.).

=> original suggestion,but simply as an extra parameter to the existing
=> command. for example:
=> 
=> *list files jobid=999 incFile="%budget%2009%" excFile="%.doc"
=> 

You mean something like:
        echo "list jobs jobid=999" | bconsole | sed -ne "/\.doc/d" -e 
/budget.*2009/p"



:)

=> to include all *budget*2009* files, except *.doc .
=> Similar extensions:
=>  - case sensitive , or not.
=>  - paths instead of file
=>  - client names
=>  - etc
=> 
=> The tricky bit may be avoiding SQL injection attacks, but there should be
=> some libraries / standard practices for dealing with this.

I think that may be a large understatement...

=> 
=> I think this may be a cleaner approach for then end user.

Personally, as an end user unfamiliar with SQL, I disagree.

=> 
=> This may not apply if you have 1,000 clients, 'list clients' may not benefi=
=> t
=> from this as it doesnt query SQL...
=> 
=> B
=> _________________________
=> {Beto|Norberto|Numard} Meijome
=> 

----
Mark Bergman                              voice: 215-662-7310
mark.bergman AT uphs.upenn DOT edu                 fax: 215-614-0266
System Administrator     Section of Biomedical Image Analysis
Department of Radiology            University of Pennsylvania
      PGP Key: https://www.rad.upenn.edu/sbia/bergman 




The information contained in this e-mail message is intended only for the 
personal and confidential use of the recipient(s) named above. If the reader of 
this message is not the intended recipient or an agent responsible for 
delivering it to the intended recipient, you are hereby notified that you have 
received this document in error and that any review, dissemination, 
distribution, or copying of this message is strictly prohibited. If you have 
received this communication in error, please notify us immediately by e-mail, 
and delete the original message.

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

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