The nexMatrix PBX systems can automatically create and send backup files. This page documents the process to set up a second nexMatrix PBX system to automatically receive and install the backup files. The backup files will then be ready and available to apply to the system if needed.
Log in to the system as user 'pbxadmin'
Note that nothing in this process requires root access or even voip user. This can be done entirely by the end-user with just the pbxadmin credentials.
This will allow the target system to upload backup files using the pbxadmin user without needing a password entered in.
Create directory .ssh if it does not already exist
mkdir -p .ssh
Edit the authorized_keys file and add the public key of the source PBX. This key can be downloaded from the PBX on the page for setting up automated backups.
Copy the text of the key file as a single line in the authorized_keys file. If the file already exists and has other key data, put the new key on a separate line from the other keys. But do make sure that there are no line breaks in the data for a particular key.
Close the file with ctrl-x and save changes.
Ensure correct permissions for the authorized_keys file. Otherwise the ssh server will refuse to use it.
chmod 600 .ssh/authorized_keys
Setting up a subdirectory for backup files greatly simplifies the command needed to automatically install the backup files. The install instructions assume that you will create this backup directory and that it is named backups.
Backup files in the pbxadmin/backups directory will not be seen by the PBX system and will not be available for restoring the system to. Set up a cron command to install the backup files to the proper location.
Decide on a time for the cron command to run. Create a cron timing string by listing the minutes, followed by the hour in 24-hour format, followed by three '*' characters - all of these components being separated by a space character.
For example, to run the command at 9:45 p.m. the cron timing string would be 45 21 * * *. I will use this timing string in the command below, modify it for your own timing requirements.
Add the following line to the end of the file:
45 21 * * * for i in /home/pbxadmin/backups/* ; do sudo /usr/local/bin/installNexMatrixBackup $i && /bin/rm $i ; done
This will install all backup files in the pbxadmin/backups directory and then delete the files from that directory so that they do not fill up the disk space.
Backup files can take up quite a bit of disk space. In cases where backup files are being generated automatically, it is recommended to remove outdated backup files automatically also to prevent the disk space from becoming too full.
Automatic removal of older backup files can be configured from the PBX UI.