System Backup and Restore
System Backup and System Restore are configured and ran in the CLI as root. There is a Backup script located at /opt/hermes/scripts/system_backup.sh and a Restore script located at /opt/hermes/scripts/system_restore.sh. These scripts should not be moved/copied to other locations. System Backups should be scheduled via Cron other other mechanism to point to /opt/hermes/scripts/system_backup.sh.
Before scheduling system_backup.sh, it's highly recommended that you run it manually to ensure proper operation before scheduling it. The backups can be stored to any mount that you have previously configured in your system such as SMB, NFS etc...
System Backup
The /opt/hermes/scripts/system_backup.sh script accepts several flags with corresponding values enclosed in single quotes in order to configure its behavior.
- The -D flag sets the number of days of backups to retain. For example, -D '7' would configure it to delete any backups older than 7 days.
- The -P flag sets the path to store the backups WITHOUT the trailing slash. For example -P '/mnt/backups' configures the backup to store all backups in the /mnt/backups path.
- The -E flag sets the recipient to send backup success/failure notifications. For example, -E 'to@domain.tld' configures the backup to send notifications to to@domain.tld.
- The -F flag sets the sender where the backup success/failure notifications would come from. For example, -F ' 'from@domain.tld' configures the backup to send notications from from@domain.tld.
- The -B flag sets the backup mode. The backup mode can be either system (backs up all Hermes related files and databases EXCLUDING the e-mail archive), archive (backs up ONLY the e-mail archive) or all (backups all Hermes related files including the databases as well as the e-mail archive). For example, -B 'system' sets the backup mode to back up all Hermes related files and databases.
- The -R flag sets the MySQL root password that the backup will need in order to back up all the Hermes databases. For example, - R 'supersercretpass' sets the MySQL root password to supersercretpass.
Putting it all together, if you wanted to run an all backup, you can run a command similar to below:
/opt/hermes/scripts/system_backup.sh -D '7' -P '/mnt/backups' -E 'to@domain.tld' -F 'from@domain.tld' -B 'all' -R 'supersercretpass'
Please note,note that runningdepending on what Backup Mode you use, the system will store an allappropriately named backup will create two separate backup filesfile in the backup location. One backup file will contain the system backup and the other backup file will contain the e-mail archive backup. Each backup file will be clearly named as a system or archive type of backup. For example, hermes-system-220410-08-16-2024-0920.tar.gz backup file is system backup as noted by the word system in its name. In case of an all Backup Mode, the system will generate two backup files, one backup file will contain the system backup and the other backup file will contain the e-mail archive backup.
Share Validation Successful
If the validation is succesful, you will receive the following message (Figure 2)
Figure 2
You will also notice that the Save Backup Job option will be enabled under the Backup Job Create Mode on top of the page. Select the Save Backup Job option and click the Submit button to save the job (Figure 3).
Figure 3
The job will be saved under the Existing Backup Jobs section on the bottom of the page (Figure 4)
Figure 4
Share Validation Unsuccessful
If the validation is unsuccesful, you will receive the following message (Figure 5).
Figure 5
Check the information supplied and share permissions and try validating the share again.
Manually Run Backup Job
Note: Only one Backup Job can be run at a time.
Any saved backup jobs will run according to the schedule you set. Alternatively if you wish to run a job immediately:
- Click on the green arrow button under the Run column to run any job immediately (Figure 6)
Figure 6
- In the Confirmation Window, click the Yes button (Figure 7). Clicking No, will take you back to the System Backup page.
Figure 7
If a Backup Job is in progress, the button under the Run column of every Backup Job will become disabled (Figure 8)
Figure 8
Delete Backup Job
If you wish to delete an existing Backup Job and the job is NOT running:
- Click on the red X under the Delete column (Figure 9)
Figure 9
- In the Confirmation Window, click the Yes button (Figure 10). Clicking No, will take you back to the System Backup page.
Figure 10