Note

You are viewing the documentation for an older release of Interworx (6.x). To see documentation for the current generally available release of Interworx, click here: 7.13.

How to: Backup / Restore SiteWorx Accounts

This section covers the InterWorx Control Panel backup system and how to restore backups of your SiteWorx accounts, both from the NodeWorx interface and the SiteWorx interface. From within NodeWorx you can restore full backups of multiple SiteWorx accounts. From within SiteWorx, you can only create a backup of that particular account, but you will be able to create partial and full backups.

Backup:

Create a SiteWorx Backup in NodeWorx

If you prefer to use the web interface, follow the steps below:

  1. Click the SiteWorx menu item if it is not already open.

  2. Click the Backup / Restore menu item.

  3. You will see a list of all the SiteWorx accounts on the server, with a checkbox next to each. If you are logged in with a NodeWorx Reseller account, you will only see the SiteWorx accounts that belong to you.

  4. Mark the checkboxes for the SiteWorx accounts you wish to backup. You may also click the [ Check All ] link at the bottom of the list to quickly check all SiteWorx accounts.

  5. Mark the labeled E-mail status to checkbox and enter your email address if you want an email sent to you when the backup process finishes. When the backup completes, you will receive an email that indicates if the backup completed successfully or not, as well as where to find the backup file.

  6. Choose the Backup option in the dropdown labeled with selected:

  7. You have now successfully initiated a backup from NodeWorx.

Create a SiteWorx Backup via CLI

The command line backup interface is less user-friendly, but you have a lot more options at your disposal. Using the command line interface is most useful when you want to automate (e.g., via CRON) the creation of SiteWorx account backups.

  1. SSH into the server

  2. su to the iworx system user. You may need to switch to the root user first (if you’re not already logged in as the root user) and then switch to the iworx user.

The command you will be running is, as the iworx user:

[iworx@test-box ~]$ /home/interworx/bin/backup.pex

backup.pex has several command line parameters:

Parameter

Description

–domains domain list

Space-seperated list of SiteWorx account domains to backup. Simple regular expressions are also allowed here (see examples below).

–domains all

Backup ALL domains on the server.

Parameter

Description

–backup-options backup options

A space separated list of what should be included in this backup. Valid options are:

  • all - Create a full SiteWorx backup, which includes all SiteWorx account related data. If –backup-options is not set, this is the default.

  • web - Backup website data

  • mail - Backup email mailboxes

  • db - Backup database data

  • no-logs - By default, site log files are included in a full SiteWorx backup. This option, used along with the “all” option above, indicates the backup should not include site log files.

  • no-stats - By default, site stats files are included in a full SiteWorx backup. This option, used along with the “all” option above, indicates the backup should not include stats log files.

–structure-only

Indicates that a “structure-only” SiteWorx backup should be created. A “structure-only” backup contains only SiteWorx related data that isn’t stored in user-accessible locations (for example, email users and passwords which are stored in the internal InterWorx database). Actual files, such as website files, actual emails, and database tables, are not included in “structure-only” backups. Because of this, “structure-only” backups are very small and are created very quickly. They are especially useful for SiteWorx accounts that have large amounts of data files, as a regular full backup could take a considerable amount of time and resources. In a “structure-only” backup, data files such as website, email, and database data are up to the user to backup on their own.

–web

DEPRECATED. Backup web data. This option is deprecated, and –backup-options web should be used instead. This option is here for backwards compatibility, and will be removed in a future release.

–mail

DEPRECATED. Backup mail data. This option is deprecated, and --backup-options mail should be used instead. This option is here for backwards compatibility, and will be removed in a future release.

–databases

DEPRECATED. Backup database data. This option is deprecated, and --backup-options db sho uld be used instead. This option is here for backwards compatibility, and will be removed in a future release.

–all

DEPRECATED. Backup all account data (includes all the above). This option is deprecated, and --backup-options all sh ould be used instead. This option is here for backwards compatibility, and will be removed in a future release.

Parameter

Description

–output-dir path

Alternate path to save backups to. If this option is omitted, the default path is each SiteWorx account’s backups directory (/home/unixuser/domain.com/iworx-backup).

–tmp-dir path

The temporary directory where the backup will be created before it is moved to the final location. If this option is omitted, the default path is set in the iworx.ini, under the [iworx.dir][tmp] setting.

–file-path=path

DEPRECATED. Alternate path to save backups to. This option is deprecated, and –output-dir should be used instead. This is here for backwards compatibility, and will be removed in a future release.

Parameter

Description

–xfer-method method

Sets the transfer method type. Valid options are:

  • ftp - Indicates the backup file should be transferred to a remote server via FTP, based on settings in the specified transfer.ini file.

  • scp - Indicates the backup should be transferred to a remote server via SCP/SSH, based on settings in the specified transfer.ini file.

If a transfer.ini file is not specified with the –xfer-ini option, the script will look in the default location for the transfer.ini file (/home/unixuser/var/domain.com/.b ackup.transfer.ini). If the default transfer.ini file is missing, the backup file will be stored in the default local location (/home/unixuser/domain.com/iworx- backup).

–xfer-ini /path/to/xfer.ini

Full path of the transfer.ini file that will be used during the backup transfer process. Note: If this option is used with multiple SiteWorx accounts, all the backups will be transferred using this single transfer.ini file.

–ftp

DEPRECATED. Indicates the backup file should be transferred via FTP. This option is deprecated, and –xfer-method ftp should be used instead. This is here for backwards compatibility, and will be removed in a future release.

–transfer-ini=/path/to/xfer.ini

DEPRECATED. Indicates the path to transfer.ini file which contains information on where to transfer the backup files. This option is deprecated, and –xfer-method ftpshould be used instead. This is here for backwards compatibility, and will be removed in a future release.

Parameter

Description

–reseller-id reseller-id

Limits the list of possible backup domains to the domains belonging to the reseller-id. If –domains parameter is not set, but –reseller-id is set, all domains under the given reseller are backed up. If –domains parameter is also set, the list will only match domains belonging to the given reseller.

–compression 1-9

Set the compression level for the final backup file. This option is identical to the gzip compression parameter, where 1 is the “quickest” and 9 is the “slowest”. If not set, it defaults to the gzip default compression level.

–quiet

Causes the script to run silently, and not print any text to the screen. Useful for cron jobs.

–email email

Email address to send backup results to.

–filename-format format-string

Sets the format of the final backup filename given the format-string provided. If this option is omitted, the default format used is set in the iworx.ini, under the [iworx.backup][filename_forma t] setting (default %D-%t-%b.%d.%Y-%H.%M.%S) .

  • %D = domain name,

  • %t = unix timestamp,

  • %b = 3-letter abbreviated month

  • %U = unix username,

  • %R = reseller id,

  • %t = backup type (full or partial),

  • %H = hour,

  • %M = minute,

  • %S = second,

  • %m = month (1..12),

  • %d = day of month (1..31),

  • %a = 3-letter day of week (Sun..Sat),

  • %Y = 4-digit year”

CLI Examples:

In its simplest form, you can create a full backup of a single SiteWorx account and have it stored in the default location (/home/unixuser/domain.com/iworx-backup):

[iworx@test-box ~]$ /home/interworx/bin/backup.pex --domains domain1.com

To create full backups of a SiteWorx account and send a status email to joe@user.com:

[iworx@test-box ~]$ /home/interworx/bin/backup.pex --domains domain1.com
--email [email protected]

To create a partial backup of web and database data of a single SiteWorx account and have it stored in the default location (/home/unixuser/domain.com/iworx-backup):

[iworx@test-box ~]$ /home/interworx/bin/backup.pex --domains domain1.com
--web --databases

To create full backups of multiple SiteWorx accounts with each backup saved in their respective backup directories:

[iworx@test-box ~]$ /home/interworx/bin/backup.pex --domains domain1.com
domain2.com

To create full backups of multiple SiteWorx accounts with each backup saved in /tmp:

[iworx@test-box ~]$ /home/interworx/bin/backup.pex --domains domain1.com
domain2.com --file-path /tmp

To create a full backup of multiple SiteWorx accounts and have them transferred to a server specified in /root/transfer.ini via FTP:

[iworx@test-box ~]$ /home/interworx/bin/backup.pex --domains domain1.com
--ftp --transfer-ini /root/transfer.ini

Create an .ini For Remote Transfers:

The following is the proper format for the transfer.ini files used by the InterWorx backup system.

[scp]
username="user"
password="your password"
hostname="hostname.domaine.tld"
remotepath="~/yourbackupdir/"
port="22"

Note that the text [scp] or [ftp] must be the first line in the file. The [scp] section is used for SCP/SSH remote transfers, and the [ftp] section is used for FTP remote transfers.

[ftp]
username="user"
password="your password"
hostname="hostname.domaine.tld"
remotepath="~/yourbackupdir/"
port="21"

If you prefer to use the web interface, follow the steps below.

Click the SiteWorx menu item if it is not already open.

Click the Backup / Restore menu item.

You will see a list of all the SiteWorx accounts on the server, with a checkbox next to each. If you are logged in with a NodeWorx Reseller account, you will only see the SiteWorx accounts that belong to you.

  1. If the SiteWorx account currently has no backups, you will see No Backups in the Status column.

  2. If the SiteWorx account does have backups you will see a [ Manage ] link in the Status column. Click the [ Manage ] link corresponding to the SiteWorx account you would like to restore.

You will see a list of all the backup files for that SiteWorx account with [ Restore ] link corresponding the the backup file you would like to restore.

Because a restore will overwrite existing data in the SiteWorx account, you will be asked to confirm. Click the Restore button to restore the account.

Restore From CLI

Restoring from the CLI is the same process as importing a SiteWorx account backup from another InterWorx server via CLI except you would want to --force the import to overwrite the existing SiteWorx instance. Please refer to the import documentation for further details.

Delete a SiteWorx Account Backup

Click the SiteWorx menu item if it is not already open.

Click the Backup / Restore menu item.

You will see a list of all the SiteWorx accounts on the server, with a checkbox next to each. If you are logged in with a NodeWorx Reseller account, you will only see the SiteWorx accounts that belong to you.

  1. If the SiteWorx account currently has no backups, you will see No Backups in the Status column.

  2. If the SiteWorx account does have backups you will see a [ Manage ] link in the Status column. Click the [ Manage ] link corresponding to the SiteWorx account you would like to restore.

You will see a list of all the backup files for that SiteWorx account with a checkbox next to each backup file. Mark the checkboxes for the files you wish to delete. You may also click the [ Check All ] link at the bottom of the list to quickly check all the backup files.

In the dropdown labeled with selected:, choose the Delete… option.

You will be asked to confirm the deletion of the backup files. Click the Delete button to finish.