Jean-François Leroux wrote:
> Hi, I've read in the documentation that you could rename the volumes 
> via a
> python script. Anyway, I can't find any example of doing this.
> I know from the docs  how to add a prefix, like "Client1-" but how can 
> I add
> for example the backup date instead of 00001 ?

Here's a copy-paste from my pools.conf director configuration file 
fragment... In the end, I stopped using labels, but why let 
documentation go to waste? :) Hopefully this will help explain how the 
variable replacement (and formatting) flags work.

=================================

http://www.bacula.org/dev-manual/Variable_Expansion.html

As a quick primer to the existing documentation, when you expand a variable, 
you can pass formatting flags.

In the pattern ${varname:format1:format2:format3} ...

An example of "format#" above could be "p/2/0/r", which translates to:"PAD to 
TWO digits with ZERO pushing things to the RIGHT"

You can test variable expansion in bconsole with the "var" command

    p/4/_/l    Pad to four digits with _'s appearing on right    

    o5-10    Substring index 5 length 10

    o0,10    Substring index 0 length 4

    u    uppercase

    l    lowercase

    #    Hash mark means return length of variable

Larger examples

    ${Month:p/2/0/r}    Month in double-digit form

    ${Level:o0-4:u}          Level in four-letter uppercase form

                   ("Incremental" to "INCR", etc.)

    ${Level:s/ /_/}          Regex: Replace spaces with underscores

    Or to translate this big kahuna:

    

    ${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}_${Level:s/ //:p/4/_/r:o0-4:u}_${Job}

    2007-01-29_FULL_client.example.com-MySuperJob 

    

    In this case the padding with underscores is done because "Level" Might be 
blank, and if it is it will cause the substring call of 0-4 to complain.

=================================

--Darien Hager
[EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to