10.2.2 Backing Up and Restoring a Command Control Configuration

The following commands can be executed on the primary console or on backup hosts. When they are executed on a backup host, the commands actually execute on the primary console.

Syntax: ./unifi -n cmdctrl [option]

If you have not mapped your local account to a Framework Manager user, replace the -n option with -u <username> -p <password> options and specify the name and password of a Framework Manager user who has the rights to perform this task.

Replace [option] with one of the following:

Option

Description

backup -t <"reason">

Backs up the current command control database. The -t <“reason”> parameter allows you to supply a reason for the backup, and is optional but recommended. Enclose the reason text in double quotes.

listcfg <format>

Lists the backups that are available for restoration. To specify a format, use one of the following:

-x: For XML output. For example: <a.Item I.version="0" who="admin" reason="Backup 1" I.timestmp="1247146780" I.id="1"/>

-D <date>: For modifying the date format. For example, if you replace <date> with %D for the format, the time stamp is displayed as 07/14/09 rather than 2009-07-14_11-52-56. For possible options, see strftime(3C).

-F <fmt>: For specifying what template information is displayed. By default, the following information is displayed.

  • id: The unique ID of the backup.

  • who: The ID of the user who created the backup.

  • reason: The reason for the backup, if provided by the user.

  • timestmp: The date and time when the backup occurred.

Replace <fmt> with one or more of these options. Individual options are enclosed with ${ }$ and separated from other options with a comma. The entire string is enclosed in single quotes. For example:

 -F '${id}$,${reason}$'

This string would print out the following:

1,Basic test rules for session closure

restore -n <id>

Restores the command control database to the select version. Replace <id> with the version number you want to restore. The current configuration is overwritten.

You cannot restore when transactions are enabled (see Command Control Transactions).

delcfg -n <id>

Deletes the selected backup from the list. Replace <id> with the version number you want to delete.

Deleting a backup is permanent and cannot be undone.

backup --?

Displays the usage help for the backup command.

listcfg --?

Displays the usage help for the list command.

restore --?

Displays the usage help for the restore command.

delcfg --?

Displays the usage help for the delete command.

Sample Commands

To back up the database:

./unifi -n cmdctrl backup -t "Added the ls command."

To restore the second backup in the list:

./unifi -n cmdctrl restore -n 2