How To: Enable and Use the SiteWorx Backups Cron Plugin

Note

Support for remote storage was added in version 7.5.0

The SiteWorx Backup Cron plugin sets up a cron job to automatically back up all of the SiteWorx accounts on the server.

Enabling the SiteWorx Backup Cron plugin creates a cronjob in the root crontab similar to the following:

[root@server ~]# crontab -l
SHELL=/bin/sh
PATH=/root
MAILTO=admin@hostname.com
0 2 * * * sh /home/interworx/plugins/siteworx-backups-cron/scripts/iwx-backup.sh 4 3 2 /backup 5
[root@server ~]#

Daily backups that are created by the SiteWorx Backup Cron will be stored in the directory that is specified in the plugin settings. Since they are not stored in the individual SiteWorx account default backup folder (/home/{unixuser}/{domain.com}/iworx-backup), backups created by this plugin will not be automatically viewable or restorable from within the SiteWorx or NodeWorx interfaces.

Backups that are created by the SiteWorx Backup Cron can be restored in two ways:

To Enable the Plugin

  1. Log in to the server at the CLI as root, either via SSH or from the terminal

  2. Create the destination partition and mount. Default expected location is /backup

Note

It is recommended that the destination directory (/backup by default) be on a dedicated backup drive or partition. Placing it on the primary drive can quickly lead to service interruptions and potential data loss if the primary partition runs out of space.

  1. Log into NodeWorx from the browser (https://ip.ad.dr.ess:2443/nodeworx)

  2. In NodeWorx, navigate to NodeWorx > Plugins

  3. Click the Pencil Icon (edit) next to SiteWorx Backups Cron under the Backup/Restore heading

  4. Select Enabled from the Status dropdown

  5. Update the Backups Path field with the destination partition created in Step 2

  6. If desired, update the Keep Daily, Keep Weekly, Keep Monthly, and Minimum Available Disk Space fields

    • Keep Daily/Weekly/Monthly: The number of Daily, Weekly, or Monthly backups that will be kept on the server, at any given time

    • Minimum Available Disk Space: The minimum percentage of disk space that must be available in order for the SiteWorx backup cron to run.

    SiteWorx Backup Cron setup form
  7. If the backups are to be stored on a remote server, select Yes from the Enable Remote SSHFS Mount dropdown. This will expand the form to provide additional required settings:

    • SSH or SCP User: The SSH or SCP username

    • SSH or SCP User Password: The SSH or SCP password for that user

    • SSH or SCP Host or IP: The hostname or IP of the remote server

    • SSH or SCP Port: The SSH or SCP port for the remote server

    • SSH Remote Backup Folder: The full path to the directory on the remote server where the backups will be stored. This folder must already exist. It will not be automatically created

    • Unmount: If Yes is selected the SSHFS remote folder will automatically be unmounted after the daily backup is complete

    SiteWorx Backup Cron remote options
  8. Click Save

Additional Options

Further customization may be set in /home/interworx/plugins/siteworx-backups-cron/scripts/iwx-backup.conf. Customizable settings include:

  • Day to run Weekly backups

  • Day to run Monthly backups

  • Backup notification email

[root@server ~]# cat /home/interworx/plugins/siteworx-backups-cron/scripts/iwx-backup.conf
#!/bin/bash
# Conf changes to this file will not be lost in future updates.  New options will be appended to this conf file.
# Which Day to run Weekly Backups  (0..6); 0 is Sunday
DAY_WEEKLY="0"
# Which Day to run Monthly Backups  (1..31) 1 or 15 is best
DAY_MONTHLY="1"
#Backup Reporting - By default the current Server Admin Email is used, un-comment and set ADMIN_EMAIL if needed..
#ADMIN_EMAIL=""
[root@server ~]#

Note

The backup notification email defaults to the primary NodeWorx users email address. To override, uncomment ADMIN_EMAIL and add the desired email address to that line.