Back up and restore
It is important to back up your application to be able to restore configuration and important data in case of a system failure. This page provides you the information on how you can back up the system in several ways.
op5backup that can create backups of system configuration data and OP5 Monitor product configurations and data.
op5backup consists of a backup script and a restore script. The backup script
op5-backup can be scheduled to run using
cron, and it can place the backups in a local or remote mounted directory, or transfer the file to another server over FTP.
op5backup does not back up
op5-logserver logs, so you need to set up remote archiving for this, or back them up manually.
To obtain a list of all
op5backup functions available, run the following command:
op5-backup --help command
The main configuration file for
op5backup is in file
You need to set the following configuration variables:
The file set this to
|storagepath=||Path to local backup storage location.|
|backupserver=||FQDN or IP address of your FTP or SFTP server.|
|backuppath=||Path to remote backup storage location.|
|backupuser=||User name for the FTP or SFTP account.|
|backuppass=||Password for the FTP or SFTP account.|
If you have added software or data to your system that you want to include in the backup, you need to add it to the
The backup modules are written in bash and use a set of variables and functions. The table below describes the variables used in a backup module script
|DESCRIPTION||A short description of the module.|
The files and folders to backup with this module. It can contain single files, file names with wildcards like
|WORK_DIR||The folder where the file is stored temporarily during the backup. Make sure there is enough free space in the specified location.|
The following table describes the functions used in an
||Used to check if it is ok to perform the backup specified in this backup module. If it is ok, it returns 0, if not it returns 1.|
||Used to specify actions performed before the actual backup is performed.|
||Used to specify what to do after a restore is performed.|
To set up cron to execute a backup script you need to edit file
For example, for backups every day at 01.59 enter the following:
59 1 * * * root /usr/sbin/op5-backup >/dev/null 2>&1
For more information about the
cron file, execute the following command:
man 5 crontab
It is possible to perform a backup without any output from the backup script, with the following command:
# op5-backup -b
To view the backup log during the backup, use the following command:
# tail -f /var/log/cron
You can use migration backup to migrate a configuration to a new major version of OP5 Monitor.
Warning: Due to an issue in the migration script, you can only upgrade from OP5 Monitor 8.4.2 to 9.4. Migrating to OP5 Monitor 9.3 and below will cause an error.
We recommend that you directly upgrade to OP5 Monitor 9.4 or newer.
You can run a migration using the following command:
No other arguments are needed when using the migration option, it uses the backup configuration.
The migration backup files will have a
migration_ as a prefix to the file name.
When upgrading or reinstalling a system using the migrate option, you need to ensure you move the backup file from the server before erasing the file system.
To run an interactive backup with a graphical interface, run the following command:
This command starts an ncurses user interface, where you can specify how and where to backup. You can choose between migration and normal backup.
To verify a backup file, run the following command:
# tar vft <op5-backup_file>
This lists all the files in the backup file. If no files are listed, the backup file might be corrupt.
Override configuration settings
To override the configuration file, run the following command:
Setting this makes
op5-backup ignore the default configuration file,
/etc/op5-backup/main.cfg. You can add backup arguments, as described below.
||Type of transfer to the storage where the backup file will be saved.|
||The directory in which to save the backup file. Valid for all transfer types.|
||Remote server to connect to.|
User name when
Password to use when
To restore a backup, execute
op5-restore with the backup file as an argument:
/usr/sbin/op5-restore [-h] -b backup_file [ -f ] [module...]
-h— shows this help.
-b— the path to the backup file to restore from.
-f— restore files only. Do not execute any post-restore actions, such as restoring the database from a dump.