3CX Backup & Restore Commands
Introduction
These commands can be used to create scripts and schedule backup and restore operations, externally to the built-in 3CX Management Console functionality. This is useful when hosting on cloud for archiving in bulk PBX users, data and configuration for safekeeping.
BackupCmd
The BackupCmd command line tool enables backups to be taken with these options:
-l, --log=VALUE | Log filename or full file path, e.g.
|
-f, --file=VALUE | *Filename to backup in default backup location or full zip archive path, e.g.
|
-o, --options=VALUE | Backup options, specifying to include in the backup:
|
--pwd=Value | Encrypt backup files with password (V15.5 Sp2 onwards), e.g.
|
-h, --help | Display command help |
--noemail | Do not send an email on backup completion, successful or not. |
Notes:
- Mandatory options are denoted above with *.
- Specifying an existing backup file with the -for--fileswitch, overwrites it without warning.
- Specify an existing log file with the -lor--logswitch to append to.
- Values, filenames and paths with space(s) are not recommended, otherwise they need to be enclosed in double quotes when used in option arguments.
- Ensure that specified backup and log file paths are writable on Linux by the “phonesystem” user, and on Windows by the executing user.
General
Specifying a filename with the “--file” or “--f” switch as a:
- filename, the backup file is stored in the backup location configured in the Management Console, e.g.
- full filename path, overrides the configured location and stores the backup file in the specified path, e.g.
When the “--log” argument is specified, it has to be followed by either:
- a filename to store the log in the current working directory, e.g.
- a full path to a local filename to override and store in the file specified, e.g.
Backup Command on Windows
To use the backup command on Windows, open a command prompt with administrative privileges, change to this directory using
- Display available backup command options:
- Make a full PBX backup and keep a log:
- Make a backup including call history, license and FQDN, keeping a log:
Backup Command on Linux
To use the backup command on Linux, run the command in a terminal as user
- Display available backup command options:
- Make a full PBX backup and keep a log:
- Make a backup including call history, license and FQDN, keeping a log:
RestoreCmd
The RestoreCMD tool enables to restore backups via command line with these options:
-l, --log=VALUE | Log path or filename |
-f, --file=VALUE | *Backup path or filename to restore |
-h, --help | Show command help |
--pwd=Value | Decrypt backup with given password (V15.5 SP2 onwards) |
--failover | Failover mode - services are not started after restore on a PBX set up as passive failover node |
Notes:
- Mandatory options are denoted above with *.
- Specify an existing log file with the -lor--logswitch to append to.
- Values, filenames and paths with space(s) are not recommended, otherwise they need to be enclosed in double quotes when used in option arguments.
- Ensure that specified log file paths are writable on Linux by the phonesystemuser, and on Windows by the executing user.
General
Specifying a filename with the “--file” or “--f” switch as a:
- filename, retrieves the backup file from the backup location configured in the Management Console, e.g.
- full filename path, overrides the configured location and retrieves the backup file from the specified path, e.g.
When the “--log” argument is specified, it has to be followed by either:
- a filename to store the log in the current working directory, e.g.
- a full path to a local filename to override and store in the file specified, e.g.
Note that the specified path needs to be writable:
- on Linux for the “phonesystem” user
- on Windows for the user set to execute the task.
Restore Command on Windows
To use the restore command on Windows, open a command prompt with administrative privileges, change to this directory using
- Display available restore command options:
- Restore a backup and start 3CX services immediately after restore:
- Restore a backup in failover mode and keep 3CX services stopped on a PBX set up as passive failover node:
Restore Command on Linux
To use the restore command on Linux, run the command in a terminal as user
- Display available restore command options:
- Restore a backup and start 3CX services immediately after restore:
- Restore a backup in failover mode and keep 3CX services stopped on a PBX set up as passive failover node:
See Also
- Learn how to Create and Convert OpenSSH Keys.
Last Updated
This document was last updated on 11 June 2023