Archive brick

The Archive brick can create, archive, and roll back directories.

Archive brick settings

Setting

Description

directory

Required. Specifies the path to the directory that will be archived. For directories on different machines, specify a working_machine.

max_archives

Required. Specifies the maximum number of archives to store. This number does not include the original directory itself, so if max_archives was set to 3, you would have the original directory plus up to three archive directories, for a total of as many as four directories.

archive_method

Optional. Must be either move (the default) or copy.

perl_binary

Optional. Specifies the path to the Perl interpreter. Defaults to whatever Perl executable is in the path.

Archive brick commands

The commands listed below can be used within Script bricks to control the archiving process:

Command

Description

create

The create operation will first create the directory if it does not exist. In addition, it creates the timestamp.txt file if it doesn't exist. This file is used by the rollback operation to record when the directory was created. If the timestamp.txt file already exists, then it is left alone.

archive

Creates an archive directory from an existing directory. The archive directory will have the same name as the original directory, but with a timestamp appended to the end. The timestamp will reflect the time when the original directory was either created or last archived, not the time when the archive operation is performed.

For example, if the original directory is called logs and was created on October 11, 2006 at 8:00 AM, the archive operation creates a directory called logs.2006_10_11.08_00_00.

rollback

Rolls back the directory to the most recent archived version. For example, say you have a directory called logs, one called logs.2006_10_11.08_00_00, and other, older versions. When you roll back, two things happen:
  • logs is renamed logs.unwanted
  • logs.2006_10_11.08_00_00 is renamed logs
The older versions are left alone.
Note: There can only be a single .unwanted directory at a time. If you roll back twice, the .unwanted directory from the first rollback is deleted.
In the following UNIX example, an Archive brick is used to create a logs archive. It would be called from a Script brick or a RunCommand session using the command logs.create.
logs : Archive
	directory = /endeca/logs
	max_archives = 3
	archive_method = move
In this UNIX example, an Archive brick is used to make backup copies of state directories. It would be called using the archive_state_MACHINE.archive command:
archive_state_MACHINE : Archive
	working_machine = MACHINE
	directory = $(project_root)/state
	max_archives = 5
	archive_method = copy