📜 ⬆️ ⬇️

Technical support 3CX responds: backup and restore 3CX from the command line

Starting from 3CX v15.5 SP1, we added two console utilities for backing up and restoring PBX configuration. They are used primarily in automation scripts, or if there is no access to the server interface.

If you are servicing a large number of cloud instances of 3CX, the automatic backup script is very convenient, because works from a single console, without requiring login to the management interface of each server. Console utilities are available in both the 3CX version for Linux and for Windows.

BackupCMD command


BackupCMD - console backup command. It has the following parameters:
')


Use of parameters


If you specify only the file name (the --file parameter), the backup will be created in the location specified in the 3CX control interface. The storage location can be a local folder, an FTP server or Google Drive. But if the parameter specifies the full path to the file, it is used, and the settings in the interface are ignored.

If the log file parameter is not specified, the file is created in the default location C: \ Program Files \ 3CX Phone System \ Instance1 \ Binbackup.log (Windows) or /var/lib/3cxpbx/Instance1/Bin/backup.log (Linux) . If only the file name is specified in the parameter, it will be used in the default location. And if the full path is specified, it overrides the default location of the log file (you can only specify a local path).

Please note that when launching the system backup script, the “phones system” user should have the right to write to the backup folder.

The --cfg parameter is used only if the BackupCMD utility is launched from a folder other than the default folder (for example, from your utility folder). In this case, the parameter value is set as follows:


Windows Backup


  1. Run the command prompt as administrator and type: cd C: \ Program Files \ 3CX Phone System \ Instance1 \ Bin
  2. To display help, type: BackupCmd.exe --help
  3. An example of a full backup command: BackupCmd.exe --file = backuptest.zip --options = ALL --log = backuptest.log
  4. An example of a backup call history command, license and FQDN: BackupCmd.exe --file = backuptest.zip --options = CH, LIC, FQDN --log = backuptest.log

Linux Backup


Commands are executed by the user “phones system” with sudo privileges:

  1. Run Terminal and type: cd / var / lib / 3cxpbx / Instance1 / Bin /
  2. To display help, type: sudo -u phonesystem / usr / sbin / 3CXBackupCmd --help
  3. An example of a full backup command is: sudo -u phonesystem / usr / sbin / 3CXBackupCmd - file = backuptest.zip - options - ALL - log = / tmp / backuptest.log
  4. Example of the call history, license and FQDN backup command: sudo -u phonesystem / usr / sbin / 3CXBackupCmd --file = backuptest.zip --options = CH, LIC, FQDN --log = / tmp / backuptest.log



RestoreCMD command


RestoreCMD is a console command for restoring a 3CX server backup. It has the following parameters:


Use of parameters


When specifying only the file name (the --file argument), the backup is searched for in the location specified in the 3CX control interface. But if the parameter specifies the full path to the file, it is used, and the settings in the interface are ignored.

If no log file option is specified, the file is not created. If only the file name is specified in the parameter, the file will be created in the default location C: \ Program Files \ 3CX Phone System \ Instance1 \ Binbackup.log (Windows) or /var/lib/3cxpbx/Instance1/Bin/backup.log (Linux ). And if you specify the full path, a log file is created along this path.

The --cfg option is used only if the RestoreCMD utility is not running from the default folder. In this case, the parameter is set as follows:


Windows Recovery


  1. Run the command prompt as administrator and type: cd C: \ Program Files \ 3CX Phone System \ Instance1 \ Bin
  2. To display help, type: RestoreCmd.exe --help
  3. Sample 3CX server recovery command: RestoreCmd.exe --file = restoretest.zip --log = restoretest.log
  4. Example of a failover node restore command: RestoreCmd.exe --file = restoretest.zip --failover --log = restoretest.log

Linux Recovery


Commands are executed by the user “phones system” with sudo privileges:

  1. Run Terminal and type: cd / var / lib / 3cxpbx / Instance1 / Bin /
  2. To display help, type: sudo -u phonesystem / usr / sbin / 3CXRestoreCmd --help
  3. Example restore command: sudo -u phonesystem / usr / sbin / 3CXRestoreCmd - file = restoretest.zip - log = / tmp / restoretest.log
  4. Sample failover node restore command: sudo -u phonesystem / usr / sbin / 3CXRestoreCmd --file = restoretest.zip --failover --log = / tmp / restoretest.log

Source: https://habr.com/ru/post/420641/


All Articles