User Tools

Site Tools


The Counter Resource

The Counter Resource defines a counter variable that can be accessed by variable expansion used for creating Volume labels with the LabelFormat directive. See the LabelFormat directive in this chapter for more details. WARNING counters are not auto-incremented. See example.

Counter Start of the Counter resource. Counter directives are optional.

Name = <name> The name of the Counter. This is the name you will use in the variable expansion to reference the counter value.

Minimum = <integer> This specifies the minimum value that the counter can have. It also becomes the default. If not supplied, zero is assumed.

Maximum = <integer> This is the maximum value value that the counter can have. If not specified or set to zero, the counter can have a maximum value of 2,147,483,648 (2 to the 31 power). When the counter is incremented past this value, it is reset to the Minimum.

*WrapCounter = <counter-name> If this value is specified, when the counter is incremented past the maximum and thus reset to the minimum, the counter specified on the WrapCounter is incremented. (This is not currently implemented).

Catalog = <catalog-name> If this directive is specified, the counter and its values will be saved in the specified catalog. If this directive is not present, the counter will be redefined each time that Bacula is started.


Definition in director configuration file:
Counter {
Name    = WeeknumberCounter
Minimum = 1
Maximum = 3
Catalog = MyCatalog 
Usage in Pool definition
Label Format = "Bacula_${Pool}-WeekTape-${WeeknumberCounter+}"
Show the current value of a counter variable

Getting the value of a counter value is like getting the value of a regular variable. As we do not want to manipulate the counter we have to omit the + sign. So:

var $WeeknumberCounter
bacula_manual/the_counter_resource.txt · Last modified: 2009/04/20 14:42 (external edit)