Resolution
OA backup script is included into the system package pleskd
and is located in the folder /usr/local/pem/bin
. The script has quite a few command-line options:
# /usr/local/pem/bin/backup.sh --help
backup.sh: back up PEM subsystem or PEM server
Usage: backup.sh [options]
--help This message
-o, -output-directory Directory to place backup file to.
Directory will be created if it does not exist.
-z GZip produced tarballs
-t <tag> Make backup with specified tag. Valid tags are:
db - back up system DB
mn - back up Management Node files
ui - back up all UI servers in PEM cluster
<arbitrary string> - create file backup from
specified list of directories
If tag is an arbitrary string, following options may also be used:
-x <path> - exclude directory or file <path> from
backup. This option may be specified
multiple times.
-h host, --host host Specify host to backup. Backup file still will
be stored locally.
For example, to backup OA database every night at 1:10am, put the following line into /etc/crontab
:
10 1 \* \* \* root /usr/local/pem/bin/backup.sh -o backups_dir -t db
where <backups_dir>
is the destination backup folder, which can be NFS mounted share.
If you do not wish to receive script output by e-mail (cron sends output to root by default, see MAILTO variable in /etc/crontab), append the string with >> /dev/null
:
10 1 \* \* \* root /root/scripts/backup.sh -o backups_dir -t db >> /dev/null
Another predefined types of backups are:
- mn - create backup of OA management node files
- ui - create backup of all UI servers in OA installation
Corresponding entries in the file /etc/crontab
may look like this:
10 1 \* \* \* root /usr/local/pem/bin/backup.sh -o backups_dir -t mn
10 1 \* \* \* root /usr/local/pem/bin/backup.sh -o backups_dir -t ui
You may also want to exclude some folders from backup which contain much static data which are not changed often, e.g. these ones:
- /usr/local/pem/var/cores - core dumps from OA components
- /usr/local/pem/vhosts - virtual hosts
/usr/local/pem/sysvhosts - system virtual hosts (since OA 2.9, e.g. - PPM packages repository is placed there)
In this case you need to pass an arbitrary string in the parameter
-t
to name backup and corresponding entry in the file/etc/crontab
may look like this (put it as a single line):10 1 \* \* \* /usr/local/pem/bin/backup.sh -o /backup -t mn-custom -x /usr/local/pem/var/cores -x /usr/local/pem/vhosts -x /usr/local/pem/sysvhosts /usr/local/pem/
Pay attention to the fact that folders in parameter
-x
must be put without trailing slash/
, e.g./usr/local/pem/var/cores
, not/usr/local/pem/var/cores/
.The command above will create backup of the whole folder
/usr/local/pem
excluding the subfolders/usr/local/pem/var/cores
,/usr/local/pem/vhosts
and/usr/local/pem/sysvhosts
, the backup will be placed in the folder/backup
. This will allow to exclude static content from backups and make them smaller in size.