Command Line Manual : cbackup


The cbackup command is the main command for CubeBackup. You can use it to check the version number, remove unnecessary data and accounts, reset the Google Workspace administrator, etc.

The cbackup command must be run on the backup server.
The cbackup file is located in the <cubebackup installation directory>/bin folder.

On Windows, cbackup.exe is located in C:\Program Files\CubeBackup4\bin by default. So you can run the C:\Program Files\CubeBackup4\bin\cbackup.exe … command in Windows Command Prompt or Windows Powershell.
On Linux, cbackup is located in /opt/cubebackup/bin by default. Run the /opt/cubebackup/bin/cbackup … command in a bash shell.

SYNOPSIS

cbackup <command> [option]

COMMANDS

The following commands can be used by cbackup.

addAPIClient: Create a CubeBackup API client.
archive: Archive a user's data to a specified storage.
filesExclude: Filter drive files included in the backup.
purgeUser: Remove the backup data of a specific user.
purgeSharedDrive: Remove the backup data of a specific shared drive.
sendMailReport: Trigger an email report on recent backup status.
removeDomain: Remove a domain from CubeBackup.
listCubeAccounts: Display CubeBackup login accounts.
setDomainAdminEmail: Change domain admin email to reflect a change of administrator made in the Google Workspace domain.
syncDataIndex: Manually merge the data index to the backup data.
version: Display CubeBackup version.

NOTE:
On Windows, most commands require Administrator privileges. Please run these commands in a Windows Powershell or Command Prompt as an Administrator.
On Linux, the addAPIClient, removeDomain, setDomainAdminEmail commands must be run as the root user in a bash shell, e.g.:

sudo cbackup removeDomain …

The archive, fileExclude, listCubeAccounts, purgeUser, purgeSharedDrive, sendMailReport, syncDataIndex commands must be run by the cbuser account, e.g.:

sudo -u cbuser  cbackup archive …

cbackup addAPIClient

Starting with version 4.9, CubeBackup provides an API for administrators to integrate the backup service to their own systems. See the CubeBackup API reference for a full list of available API calls.

Before getting started with the CubeBackup API, you will need to create an API client, and pass along an API key as the authentication token in all API calls.

SYNOPSIS

cbackup addAPIClient <"client_name">

OPTIONS

  • -keyOnly

    Using this option, the command will return only the API key in response, which may help automate API client creation in your CubeBackup integration.

  • -admin

    By default, an individual CubeBackup API client will be granted root privileges. However, CubeBackup also supports creating a linked API client for an existing CubeBackup admin, with identical permissions based on the role of the CubeBackup admin.

    Using this option, you will need to pass along a CubeBackup admin email address, which will be automatically assigned as the API client name. For example:

    sudo /opt/cubebackup/bin/cbackup addAPIClient -admin [email protected]

NOTE:

  • The API key will only be displayed once when it is created and cannot be retrieved in the future. Please be sure to save the key in a secure location for future usage.
  • This command requires Administrator/root privileges.

    If CubeBackup runs on Windows, please run this command as an Administrator.
    If CubeBackup runs on Linux, please use sudo … in the bash shell.

cbackup archive

The cbackup archive command allows you to archive a user's data to a location of your choice. This is especially useful when an employee has left your organization and you would like to keep an archive of his data locally for possible future use.

SYNOPSIS

cbackup archive <domain name> <user email or shared drive id> <app> <destination path>
  • domain name: the name of your domain (e.g. mycompany.com)
  • user email/shared drive id: the user account you wish to archive (e.g. [email protected]), or a shared drive ID (e.g. AAGFI5-SlBKnUk9PV)
  • app: must be one of these values: all, gmail, drive, calendar, contacts, sites. Choose all to archive all Google Workspace data for this user.
  • destination path: The output directory. This can be a local directory or a location on your network.

TIP: If you want to compress the archive data to a ZIP file, you can also specify the name of the ZIP file as the destination path. For example:

cbackup archive mycompany.com  [email protected] all  /var/archive/cube.zip

will archive all data of user [email protected] into the cube.zip file instead of exporting all files into a directory.

NOTE: This command requires special privilege.
On Windows, it must be run by an Administrator account.
On Linux, it must be run by the cbuser account.

If CubeBackup runs on Windows, please run this command as an administrator.
If CubeBackup runs on Linux, please use "sudo -u cbuser …" in a bash shell.

EXAMPLES

Suppose you want to archive all Google Workspace data for user [email protected] to a directory named archive_data. (The directory can be located on a local disk or on your network.)

  1. Login to the backup server.
  2. Open a Windows Powershell or Windows Command Prompt using an Administrator account.
  3. In the <cubebackup installation folder>/bin directory, run the command:

    cbackup archive companydomain.com  [email protected] all f:\archive_data
  1. SSH into the backup server.
  2. Make sure cbuser has write permission to the target directory. One way to do this is to change the owner of the target directory to cbuser.

    sudo chown cbuser:cbuser  /mnt/archive_data
  3. In a bash shell, run the command:

    sudo -u cbuser cbackup archive companydomain.com  [email protected] all  /mnt/archive_data/abc

cbackup filesExclude

Some organizations may not wish to back up large or unimportant files in Google Drive or Shared drives in order to save backup storage space.

To filter out these files from the backup storage, you can set file exclusion rules on the SETTINGS > Apps > Options dialog. For detailed information about how to set file exclusion rules, please refer to Exclude files that match any of the following rules.

To protect the safety of your backup set, CubeBackup will not automatically use these rules to purge files which have previously been backed up. You must run the cbackup filesExclude remove command to manually purge those unwanted files from the backup data. For more information on how to remove unnecessary files from backup storage, see this tutorial.

This command has two subcommands: cbackup filesExclude list and cbackup filesExclude remove.

cbackup filesExclude list

This command will list backup files which match the File exclusion rules. This is useful to check which currently backed up files will be excluded from future backups using the rules set in the CubeBackup web console. It is strongly recommended that you run this command before the cbackup filesExclude remove command to double-check which files will be deleted from your backup.

SYNOPSIS

cbackup filesExclude list <domain name>

NOTE: This command requires special privileges.

  • On Windows, it must be run by an Administrator account.
  • On Linux, it must be run by the cbuser account. For example:

    sudo -u cbuser /opt/cubebackup/bin/cbackup filesExclude list mydomain.com

cbackup filesExclude remove

This command removes files matching the rules set in the CubeBackup web console from your backup set.

SYNOPSIS

cbackup filesExclude remove <domain name>

Note:

  1. Before purging unwanted files from the backup storage, please run the cbackup filesExclude list command to check which files will be removed.

  2. Before running this command, you should first stop the CubeBackup service.

    Please run this command.

    sudo /opt/cubebackup/bin/cbsrv stop

    Open a Command Prompt as Administrator, and run this command.

    "C:\Program Files\CubeBackup4\bin\cbsrv.exe" stop

    Open the Windows PowerShell as Administrator, and run this command.

    & "C:\Program Files\CubeBackup4\bin\cbsrv.exe" stop

    Please run this command to stop the container.

    sudo docker stop <container-name>

  3. This command requires special privileges.
    On Windows, it must be run by an Administrator account.
    On Linux, it must be run by the cbuser account. For example:

    sudo -u cbuser /opt/cubebackup/bin/cbackup filesExclude remove mydomain.com

cbackup listCubeAccounts

The cbackup listCubeAccounts command will display all CubeBackup login accounts. If you've forgotten the admin account or cannot reset the password directly on the login page, please run this command on the CubeBackup server. With the correct account, you can either log in to the web console directly or reset the password by sending a link to your email address.

SYNOPSIS

cbackup listCubeAccounts

NOTE: This command requires special privileges.

  • On Windows, it must be run by an Administrator account.
  • On Linux, it must be run by the cbuser account. For example:

    sudo -u cbuser /opt/cubebackup/bin/cbackup listCubeAccounts 
  • If you are still locked out of the web console, please visit Solution3 at How to recover my CubeBackup account.

cbackup purgeUser

The cbackup purgeUser command allows you to remove the backup data of a specific user. This can be helpful when you need to purge an unwanted user who has left your organization. For detailed information on purging a user, please refer to How to remove backups for a specific user or shared drive.

SYNOPSIS

cbackup purgeUser <user email>

Note:

  1. Before running this command, you should first stop the CubeBackup service.

    Please run this command.

    sudo /opt/cubebackup/bin/cbsrv stop

    Open a Command Prompt as Administrator, and run this command.

    "C:\Program Files\CubeBackup4\bin\cbsrv.exe" stop

    Open the Windows PowerShell as Administrator, and run this command.

    & "C:\Program Files\CubeBackup4\bin\cbsrv.exe" stop

    Please run this command to stop the container.

    sudo docker stop <container-name>

  2. This command requires special privileges.
    On Windows, it must be run by an Administrator account.
    On Linux, it must be run by the cbuser account.

    sudo -u cbuser /opt/cubebackup/bin/cbackup purgeUser <user email>

cbackup purgeSharedDrive

The cbackup purgeSharedDrive command allows you to remove the backup data of a specific shared drive. This can be helpful when you need to free up space by removing a shared drive that is no longer needed. For detailed information on purging a shared drive, please refer to How to remove backups for a specific user or shared drive.

SYNOPSIS

cbackup purgeSharedDrive <shared drive id>

Note:

  1. Before running this command, you should first stop the CubeBackup service.

    Please run this command.

    sudo /opt/cubebackup/bin/cbsrv stop

    Open a Command Prompt as Administrator, and run this command.

    "C:\Program Files\CubeBackup4\bin\cbsrv.exe" stop

    Open the Windows PowerShell as Administrator, and run this command.

    & "C:\Program Files\CubeBackup4\bin\cbsrv.exe" stop

    Please run this command to stop the container.

    sudo docker stop <container-name>

  2. This command requires special privileges.
    On Windows, it must be run by an Administrator account.
    On Linux, it must be run by the cbuser account.

    sudo -u cbuser /opt/cubebackup/bin/cbackup purgeSharedDrive <shared drive id>
  3. You can find the ID of the shared drive in the URL of the shared drive's Restore page.

cbackup removeDomain

Many Google Workspace administrators and Google Workspace partners back up multiple Google Workspace domains using CubeBackup. The cbackup removeDomain command can be used to remove a Google Workspace domain from the backup list.

SYNOPSIS

cbackup removeDomain <domain name>

NOTE:

  • The cbackup removeDomain command removes only the domain (not the backup data) from CubeBackup. That is, CubeBackup will no longer back up the specified domain, but the backup data for this domain remains completely untouched.
  • If a restore request comes up for this domain after it has been removed, you can add this Google Workspace domain again and the backups for this domain will once again show up in the RESTORE page.
  • Please do NOT use this command if you only have one Google Workspace domain in CubeBackup. Removing the sole domain will crash CubeBackup.
  • This command requires Administrator/root privilege.

    If CubeBackup runs on Windows, please run this command as an administrator.
    If CubeBackup runs on Linux, please use sudo … in the bash shell.

For detailed instructions on how to use this command, please refer to How to remove a Google Workspace domain from CubeBackup.

cbackup sendMailReport

The cbackup sendMailReport command will generate an email report on recent backup status and send it to the system admin or the recipients you've specified in the web console. This can be helpful when you have missed an important email report or need to trigger an email report on demand.

SYNOPSIS

cbackup sendMailReport <daily|weekly|monthly>

NOTE: This command requires special privileges.

  • On Windows, it must be run by an Administrator account.
  • On Linux, it must be run by the cbuser account. For example:

    sudo -u cbuser /opt/cubebackup/bin/cbackup sendMailReport <daily|weekly|monthly> 

cbackup setDomainAdminEmail

CubeBackup relies on the correct Google Workspace domain administrator account for domain-wide OAuth authentication. If the administrator of your Google Workspace domain has been changed, all Google API requests will fail and CubeBackup will no longer work until it has been updated with the new Google Workspace domain administrator information.

SYNOPSIS

cbackup setDomainAdminEmail <domain name> <new admin email>

NOTE:

  • This command requires Administrator/root privilege.

    If CubeBackup runs on Linux, please use "sudo …" in the bash shell.
    If CubeBackup runs on Windows, please run this command as an administrator.

  • After updating CubeBackup with the new Google Workspace domain administrator email, you need to restart the CubeBackup service in order for the changes to take effect.

    Please run this command.

    sudo /opt/cubebackup/bin/cbsrv restart

    Open a Command Prompt as Administrator, and run this command.

    "C:\Program Files\CubeBackup4\bin\cbsrv.exe" restart

    Open the Windows PowerShell as Administrator, and run this command.

    & "C:\Program Files\CubeBackup4\bin\cbsrv.exe" restart

    Please run this command to restart the container.

    sudo docker restart <container-name>

EXAMPLES

Suppose your Google Workspace domain administrator has been replaced or renamed and the new administrator's email is [email protected]. All Google API requests will fail until CubeBackup is updated with the new administrator's information using the command cbackup setDomainAdminEmail.

  1. Login to the backup server.
  2. Open a Windows Powershell or Windows Command Prompt using an Administrator account.
  3. In the <cubebackup installation folder>/bin directory, run the command:

    cbackup setDomainAdminEmail  companydomain.com  [email protected]
  4. Restart the CubeBackup service:
    Open a Command Prompt or Windows Powershell as Administrator and run the following command:

    "C:\Program Files\CubeBackup4\bin\cbsrv.exe" restart # in Command Prompt 
    
    & "C:\Program Files\CubeBackup4\bin\cbsrv.exe" restart # in Windows Powershell 
    

  1. SSH into the backup server.
  2. In a bash shell, run the command:

    sudo /opt/cubebackup/bin/cbackup setDomainAdminEmail companydomain.com  [email protected]
  3. Restart the CubeBackup service

    sudo /opt/cubebackup/bin/cbsrv restart

cbackup syncDataIndex

The cbackup syncDataIndex command manually merges all index data to the backup data. This command is only used under special circumstances.

SYNOPSIS

cbackup syncDataIndex

NOTE: This command requires special privilege.

  • On Windows, it must be run by the Administrator account.
  • On Linux, it must be run by the cbuser account. For example:

    sudo -u cbuser /opt/cubebackup/bin/cbackup syncDataIndex

cbackup version

This command will display the current version of CubeBackup.

SYNOPSIS

cbackup version