Article ID: m0578Last Modified: 29-Sep-2024

Using Command Line in Backup Agent for Linux (classic CLI)

To start using the command line, start a new terminal session, then navigate to the directory that contains the cbb tool:

cd /opt/local/Online/ Backup (or your rebranded name)/bin

Select Edition

As of version 3.1.2 of Backup Agent for Linux, you can select the required edition from the list of the available editions

To select the required edition, use the following command:

./cbb option

The command has the following parameters:

./cbb option -get edition Displays the current edition and available editions
./cbb option -set edition -v {edition} Set the new Backup Agent  edition. Possible values: Desktop, Ultimate
./cbb option -set edition -h Displays the command help

Add New Managed Backup User

To add a new user, run the ./cbb addAccount command:

./cbb addAccount -e UserName -p Password -ssl yes|no

where:

  • -e -- user account
  • -p -- password
  • -ssl -- SSL mode. Possible values: yes, no

Add Storage Account

To create a local backup destination, you need to specify a File Storage account:

./cbb addAccount -d DisplayName -st FileSystem -c Path

where:

  • -d -- any name you want to use to identify your account.
  • -st -- it should be "FileSystem"
  • -c -- path where you want to back up to.
  • -bp -- backup prefix (a computer name by default). It is an advanced option that is used to identify a backup for a specific computer.

List Available Storage Accounts

To list available storage accounts, execute the following command:

./cbb account -l

Synchronize Repository

Specify the following parameters to run a repository synchronization:

  • -s (-sync) Run a repository synchronization for a specified storage account
./cbb account -s "MyS3"

Note that the storage account name must be in quotes

Edit Storage Account

To edit a storage account, use the following command:

./cbb editAccount -d "account name"

Note that the storage account name must be in quotes

Create a Backup Plan

To create a backup plan, use the ./cbb addBackupPlan command.

For example, you are going to:

  • backup all the files from the "/home/NAME/Documents/" directory
  • exclude the "/home/NAME/Documents/books/" folder
  • use compression
  • run every workday at 23:00
  • receive notification on completion:
./cbb addBackupPlan -n "Backup my docs" -a "myaccount" -f "/home/NAME/Documents/" -ef "/home/NAME/Documents/books/" -c yes -every week -at "23:00" -weekday "mo, tu, we, th, fr" 

To get general help for the commands, run the following command:

./cbb addBackupPlan

Output:

addBackupPlan -n planName -a <accountName | accountID> [-en <yes | no>] [-rrs <yes | no>] [-sse <yes | no>] -f <pathToFile | pathToDir> -ef <pathToFile | pathToDir> [-es <yes | no>] [-c <yes | no>] [-ea <AES128> -ep password] [-bef <yes | no>] [-purge delete_after_time -dlv <yes | no> -keep keep_versions_number] [-dl <yes -dld delete_locally_deleted_delay | no>] [[[-every [day, week, month, dayofmonth] <-workTime xx:xx-xx:xx -recurrencePeriod period | -at timeOfDay>] [-day [1..31]] [-weekday list ofWeekDays] [-weeknumber weeknumber] ] | -at onceDateTime] ] 

Note: the sequence of parameters must be in the strong order

The output contains special parameters, where:

  • Backup Settings
    • -n Plan name
    • -a "AccountID" or "AccountName". The value of the account name you can find in the Management Console. In the Storage Accounts tab, find the required storage account, click the gear icon, select View Backup Destinations and learn the value in the Display Destination Name column)
    • -en enable a plan after creation. Possible values: yes (default) | no
    • -rrs - use RRS (for Amazon S3 only). Possible values: yes | no (default)
    • -sse - use SSE (for Amazon S3 only). Possible values: yes | no (default)
    • -f - file or folder to back up. To specify multiple files/folders, use -f for every file/folder.

Example:

-f "/home/USERNAME/Downloads/stats.txt" -f "/home/USERNAME/Downloads/WeeklyReports"

-ef - exclude a file or a directory from a backup procedure. To exclude more than one object, use -ef for each object.

Example:

-f "/home/USERNAME/Downloads/stats.txt" -f "/home/USERNAME/Downloads/WeeklyReports" -ef "/home/USERNAME/Downloads/WeeklyReports/Sunday" -ef "/home/USERNAME/Downloads/WeeklyReports/unrelated.txt"

-es - exclude system files from the backup procedure.

Possible values:

  • yes (default)
  • no.

The following folders will be excluded: /bin; /boot; /cdrom; /dev; /etc; /media; /lib; /lib64; /lost+found; /mnt; /opt; /proc; /run; /sbin; /srv; /tmp; /usr; /var.

-c - use compression. Possible values: yes, no (default). -ea - enable encryption and set an encryption algorithm to use. Possible values:

  • AES_128
  • AES_192
  • AES_256

Used only with -ep parameter.

-ep - encryption password. Used only with -ea parameter.

Example:

-ea "AES_128" -ep "qwerty123"

-bef - back up empty folders. Possible values: yes, no (default).

Retention Settings

  • -purge. Purge versions that are older than the defined period (except the latest version). Possible values: d(day), w(week), m(month)
  • -dlv. Delete the last version if it is older than the defined period. Possible values: yes, no
  • -keep. Keep a limited number of versions. Possible values: number
  • -dl. Delete files that have been deleted locally. Possible values: yes, no
  • -dld. Keep the files deleted locally for the specified number of days in case you relax the purge settings and the files become valid again. Possible values: number of days

Example: keep only 3 file versions

-keep 3

Example: keep file versions for 1 week without keeping the last version

-purge 1w -dlv

Schedule Settings

Schedule settings allow you to run a backup at a certain time (-at) or to have a recurring backup (-every). Note: Time is always set in UTC:

  • -every. Specify a recurring schedule. Possible values: day, week, month, dayofmonth. Two types of schedules: recurring at a certain time (use with -at) and recurring from/to time within a period (use with -workTime in format hh:mm-hh:mm and -recurrencePeriod in minutes)
  • -workTime. Specify a time when a plan can be running. Format xx:xx-xx:xx. Example 1: 12:32-17:00; Example 2: 23:00-04:00; may be used for each recurring schedule, used only with -recurrencePeriod and without -at
  • -recurrencePeriod. Specify recurrence period in minutes
  • -at. Specify datetime or time of a schedule. Example: -at "16.02.2015 12:32" or -at "12:32" for each recurring schedule
  • -every day

Example (with -at):

-every day -at "12:31"

Example (with -workTimeand -recurrencePeriod):

-every day -workTime "12:00-16:00" -recurrencePeriod 15

-every week - run every week on a specified day(s) of the week. Used with the -weekday listOfWeekDays parameter. Specify the day(s) of the week for a week schedule: "su, mo, tu, we, th, fr, sa". Use the same options to run -at or with -worktime and -recurrencePeriod.

Example:

-every week -at "13:00" -weekday "mo,su"

-every month. Run every month in a specified day(only one day in a month). You need to specify -weekday and -weeknumber. Possible values: First | Second | Third | Fourth | Penultimate | Last. And the same options to run -at or with -worktime and -recurrencePeriod.

Example:

-every month -at "14:00" -weekday "mo" -weeknumber "Last"

-every dayofmonth. Run every specified day in a month. You need to specify -day. Possible values: 1..31.

Example:

-every dayofmonth -at "03:00" -day 30

-r You can run plan immediately:

./cbb plan -r "plan_name"

Create Restore Plan

To create a restore plan use the ./cbb addRestorePlan command.

For example, you are going to restore only new files from the "/" folder by running the sync before restoring, to /home/link/workspace/testRestore/. Files are encrypted with the pass = qwert123. Run restore every day at 11:40:

./cbb addRestorePlan -n "RestorePlan" -a "myaccount" -sy yes -f "/" -ep "qwert123" -se no -ol no -de "/home/link/workspace/testRestore/" -on yes -every day -at "11:40"

Read the help for the command:

./cbb.exe addRestorePlan

Output:

addRestorePlan -n planName -a accountName | accountID -en [yes|no] -sy [yes|no] -rt [LatestVersion|[PointInTime date]] -f [-ep password] [-se yes|no] [-ol yes|[no -de location] [-on yes|no] [[[-every [day, week, month, dayofmonth] <-workTime xx:xx-xx:xx -recurrencePeriod period | -at timeOfDay>] [-day [1..31]] [-weekday list OfWeekDays] [-weeknumber weeknumber] ] | -at onceDateTime] ]]

Note: the sequence of parameters is strongly fixed

The output contains special parameters, where:

  • Restore Settings
  • -n - a plan name
  • -a - "AccountID" or "AccountName". (You can find it on the MBS control panel. Go to the "Storage Accounts" tab, and refer to the Display Name section in the bottom Destinations list.)
  • -en - enable a plan after it has been created. Possible values: yes (default) | no
  • -sy - sync before restoring. Possible values: yes| no (default). You need to sync before restoring if you set up a restore plan on a computer that is different from the one you have run a backup on
  • -rt - a restore type. Possible values: LastVersion (default) | PointInTime. For PointInTime you need to specify a timestamp. Example: -rt PointInTime "16.02.2015 12:32"
  • -f - restore a file or a folder. Specify a full path to the file or folder that you are going to restore. To restore multiple objects, use multiple -f parameters

Example:

-f "/home/USERNAME/Downloads/file" -f "/home/USERNAME/Downloads/Folder"

  • -ep - a decryption password
  • -se - skip existing files. Possible values: yes (default) | no
  • -ol - restore to the original location. Possible values: yes | no
  • -de - specify a restore destination, used only with the -ol = no

Example:

-ol no -de "/home/USERNAME/anotherFolder/"

  • -on - restore only new files. Possible values: yes (default) | no

Schedule settings

Schedule settings allow you to run a restore plan at a certain time (-at) or to have a recurring restore (-every). Note: Time is always set in UTC:

  • -every - specify a recurring schedule. Possible values: day, week, month, dayofmonth. Two types of schedules: recurring at a certain time (use with -at) and recurring from/to time within a period (use with -workTime in format hh:mm-hh:mm and -recurrencePeriod in minutes)
  • -workTime - specify a time when a plan can be running. Format xx:xx-xx:xx. Example 1: 12:32-17:00; Example 2: 23:00-04:00; may be used for each recurring schedule, used only with -recurrencePeriod and without -at
  • -recurrencePeriod - specify recurrence period in minutes
  • -at - specify datetime or time of a schedule. Example: -at "16.02.2015 12:32" or -at "12:32" for each recurring schedule
  • -every day

Example (with -at):

-every day -at "12:31"

Example (with -workTimeand -recurrencePeriod):

-every day -workTime "12:00-16:00" -recurrencePeriod 15

-every week - run every week on a specified day(s) of the week. Used with the -weekday listOfWeekDays parameter. Specify the day(s) of the week for a week schedule: "su, mo, tu, we, th, fr, sa". Use the same options to run -at or with -worktime and -recurrencePeriod.

Example:

-every week -at "13:00" -weekday "mo,su"

-every month. Run every month in a specified day(only one day in a month). You need to specify -weekday and -weeknumber. Possible values: First | Second | Third | Fourth | Penultimate | Last. And the same options to run -at or with -worktime and -recurrencePeriod.

Example:

-every month -at "14:00" -weekday "mo" -weeknumber "Last"

-every dayofmonth. Run every specified day in a month. You need to specify -day. Possible values: 1..31.

Example:

-every dayofmonth -at "03:00" -day 30

-r You can run plan immediately:

./cbb plan -r "plan_name"

Manage Plans

You can also delete, enable/disable a plan, list plans.

To list all existing plans, use the ./cbb plan -l command.

To delete a plan, use the ./cbb deletePlan -n PlanName command, where:

  • -n - a plan name

To enable/disable a plan, use the ./cbb changePlanState -n PlanName -s on | off command, where:

  • -n - a plan name
  • -s - plan state. Possible values: on | off

Troubleshoot and Report Issues

Click Settings, then select Diagnostic and specify user's email and a short description of the issue. Click Send to support.

OR use the following command to report an issue or send any feedback:

./cbb sendLog -u username -m message

where:

  • -u - a user name (any)
  • -m - a short description of the issue/feedback

Example:

./cbb sendLog -u "John Smith" -m "There is an error during creating backup plan..."

To get general help for the commands, run the cbb command.

Logging Level

You can change the logging level using the command line interface. To do this, use the following command:

/opt/local/Online Backup/bin/cbb" option -set logging -mode High

Note that the Online Backup path part may be different if you installed the Backup Agent to a custom location

Possible values for -mode parameter:

  • Low
  • High
  • Debug

Configuring Proxy Settings

To configure proxy settings, run the following command:

./cbb option -set ps -pt type -pa address -pp port -pu user -ps password

where:

  • -pt is the proxy type. Possible values: no / manual
  • -pa is the proxy address
  • -pp is the proxy port
  • -pu is the proxy username
  • -ps is the proxy user password

Uninstall Backup Agent

For Ubuntu OS, use the following command: sudo dpkg -r PRODUCT_NAME

For other OS of the Linux family: sudo rpm -r PRODUCT_NAME

https://git.cloudberrylab.com/egor.m/doc-help-mbs.git