backup-domain

Backup one or more virtual servers

This program is analogous to the Backup Virtual Servers page in the Virtualmin web interface. It will create either a single backup file or multiple separate files containing the domains specified on the command line, either locally or on a remote SCP or FTP server.

The --dest option sets the backup destination, and can be a simple path like /backup/virtualmin.tgz , an FTP URL like ftp://user:pass@server:/backup/virtualmin.tgz , or an SCP URL like ssh://user:pass@server:/backup/virtualmin.tgz . When backing up to a single file, the path specifies a file that will be created. When creating one backup per domain, it specifies a directory instead.

The --domain and --all-domains options can be used to control which virtual servers are included in the backup. The --domain parameter followed by a domain name can be given multiple times, to select more than one server.

Alternately, virtual servers can be selected with the --user flag followed by an administrator's username, or --plan followed by a plan name. In both cases, all sub-servers will be included too.

Typically the --all-features option will be used to include all virtual server features in the backup, but you can instead use the --feature option one or more times to control exactly what gets included. In this case, it is wise to use at least --feature dir to include each server's home directory.

The --separate option tells the backup program to create a separate file for each virtual server. The --newformat also causes multiple files to be created, but using the format supported by Virtualmin versions 2.86 and above which puts all information into each domain's home directory, and thus avoids the need to create a large file in /tmp during the backup process.

Using the --ignore-errors option means than any errors encountered backing up one feature or server will be reported and ignored, rather than terminating the whole backup as happens by default.

To include core Virtualmin settings in the backup, the --all-virtualmin option can be specified as well. Alternately, you can select exactly which settings to include with the --virtualmin parameter. For example, --virtualmin config would only backup the module configuration.

By default, backups include all files in each domain's home directory. However, if you use the --incremental parameter, only those changed since the last non-incremental backup will be included. This allows you to reduce the size of backups for large websites that rarely change, but means that when restoring both the full and incremental backups are needed.

To exclude some files from each virtual server's home directory from the backup, use the --exclude flag followed by a relative filename, like public_html/stats or .bashrc.

To have Virtualmin automatically replace strftime-style date formatting characters in the backup destination, you can use the --strftime flag. When this is enabled, the --purge flag can also be given, followed by a number of days. The command will then delete backups in the same desination directory older than the specified number of days.

Command Line Help

Creates a Virtualmin backup, for the domains and features specified on the command line.

virtualmin backup-domain [--dest file]+
                         [--test]
                         [--domain name] | [--all-domains]
                         [--user name]
                         [--plan name]
                         [--feature name] | [--all-features]
                                            [--except-feature name]
                         [--ignore-errors]
                         [--separate] | [--newformat]
                         [--onebyone]
                         [--strftime] [--purge days]
                         [--incremental]
                         [--all-virtualmin] | [--virtualmin config]
                         [--option "feature name value"]
                         [--as-owner]
                         [--exclude file]*

Multiple domains may be specified with multiple --domain parameters. 

Features must be specified using their short names, like web and dns.

The destination can be one of :
 - A local file, like /backup/yourdomain.com.tgz
 - An FTP destination, like ftp://login:pass@server/backup/yourdomain.com.tgz
 - An SSH destination, like ssh://login:pass@server/backup/yourdomain.com.tgz
 - An S3 bucket, like s3://accesskey:secretkey@bucket Multiple destinations can be given, if they are all remote.