Bacula-users

Re: [Bacula-users] bconsole scripting

2010-06-01 13:33:30
Subject: Re: [Bacula-users] bconsole scripting
From: Morty Abzug <morty AT frakir DOT org>
To: Kern Sibbald <kern AT sibbald DOT com>
Date: Tue, 1 Jun 2010 13:31:26 -0400
On Thu, May 27, 2010 at 05:45:52PM +0200, Kern Sibbald wrote:
> On Thursday 27 May 2010 17:23:46 Morty Abzug wrote:

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

If I do an "echo list media | bconsole", I see the following:

Connecting to Director hostna:9101
1000 OK: hostna-dir Version: 5.0.1 (24 February 2010)
Enter a period to cancel a command.
list media pool=Daily
Automatically selected Catalog: MyCatalog
Using Catalog "MyCatalog"
+---------+-------------------+-----------+---------+-----------------+----------+--------------+---------+------+-----------+-----------+---------------------+
| MediaId | VolumeName        | VolStatus | Enabled | VolBytes        | 
VolFiles | VolRetention | Recycle | Slot | InChanger | MediaType | LastWritten  
       |
+---------+-------------------+-----------+---------+-----------------+----------+--------------+---------+------+-----------+-----------+---------------------+
|      17 | hostna-LTO2-FRI-1 | Used      |       1 | 121,534,027,776 |       
51 |      345,600 |       1 |    0 |         0 | LTO-2     | 2010-05-29 
06:28:49 |
[snip]
+---------+-------------------+-----------+---------+-----------------+----------+--------------+---------+------+-----------+-----------+---------------------+
You have messages.

Everything but the part in the table is not useful to my query.  The
table, in turn, is formatted for human readability, with various ASCII
line drawing characters.  A batch mode, such as supplied with some
other tools, would not include anything but the table without line
drawing characters.

I've worked around this in the past, BTW, by doing:

  echo list media pool=Daily|bconsole |grep '^|'|tail -n +2|sed 's,|,,g'

It would be nice to be able to do this kind of thing without playing
shell script games, though.  Thanks!

- Morty

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

_______________________________________________
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>
  • Re: [Bacula-users] bconsole scripting, Morty Abzug <=