How to Start a cPanel Backup Job Manually

Introduction

If a backup is ever stopped prematurely or if you just need to run a backup, you’ll need to use the command-line.

Procedure

Run a system backup

To run a system-wide backup manually, log into the command line via SSH as the root user and run the following command:

# /usr/local/cpanel/bin/backup

Options

The /usr/local/cpanel/bin/backup script accepts the following options:

OptionDescription
--debugRuns the backup in the foreground and prints its progress on the command line.
--forcePerforms an additional backup, even if the system already contains up-to-date backup files.
--allow-overrideWhen the system performs the backup, use the pkgacct script in the the /var/cpanel/lib/Whostmgr/Pkgacct/pkgacct directory.
--helpDisplays additional information.



Run a single account backup

To back up a single cPanel account, you can use  The pkgacct Script instead.

To use this script, log into your server via SSH as root. Then run the following command, optionally adding flags, followed by the username of the cPanel user you’d like to backup, and the directory you’d like used for the output.

# /usr/local/cpanel/scripts/pkgacct [options] USERNAME DIRECTORY

Options

The /usr/local/cpanel/scripts/pkgacct script accepts the following options:

OptionDescriptionExample
USERNAMERequired
The cPanel account username for which to create a cpmove archive. You must pass this option after any options, but before the DIRECTORY option.
example
DIRECTORYThe directory path in which to store the archive. By default, the script uses the /home directory. You must pass this option after the USERNAME option./usr/local/cpanel/backups
--allow-overrideUse the /var/cpanel/lib/Whostmgr/Pkgacct/pkgacct file to package the account, if it exists. Note: You must pass this option before any other options.--allow-override
--mysql=VERSIONThe archive’s required minimum version of MySQL®.--mysql=5.1.1
--roundcube=VERSIONThe archive’s required minimum version of Roundcube.--roundcube=3.0
--dbbackup=TYPEThe type of database backup to perform: all — The script backs up all of the database information. This is the default option. schema — The script only backs up the database schemas. Only use this option to track a database’s users if you back up your databases through a different method. name — The script only backs up the database names. MySQL databases transfer as placeholders containing a CREATE TABLE statement. PostgreSQL® databases transfer as empty .tar placeholder files.--dbbackup=all
--dbbackup_mysql=TYPEAn override of the --dbbackup option for MySQL only. This option accepts the same values as the --dbbackup option. Note: If you pass both this option and the --dbbackup option, the system applies the --dbbackup_mysql option to MySQL and the --dbbackup option to PostgreSQL. This option has no effect on PostgreSQL backups.--dbbackup_mysql=all
--get_versionDisplay the version of the pkgacct script.--get_version
--use_backupsUse the account’s last known successful backup as a template when the script creates the archive. Use this option to speed up the backup process.--use_backups
--incrementalUpdate the destination file with any new content since the previous backup. This option also removes any content that no longer exists on the account. If the destination file does not exist, the script creates a new file in that location. Note: This option will pass the --nocompress option to create an uncompressed archive.--incremental
--splitCreate the archive in smaller data files. This option reduces the overall load on the system and makes it easier to transfer the files. The system creates these files in the cpmove-USERNAME.tar.gz.part00001 format, where USERNAME is the user’s account and part00001 is the file’s incremental ID.--split
--nocompressDo not compress the archive.--nocompress
--userbackupAllow the user to use the archive as a backup file for the account (for example, backup-3.18.2020_09-16-55_USERNAME). The system creates the file in the /home/USERNAME directory, where USERNAME is the user’s account name. This file is compatible with WHM’s Restore a Full Backup/cpmove File interface (WHM >> Home >> Backup >> Restore a Full Backup/cpmove File).--userbackup
--backup=FILEPATHUse the archive as a backup for the account at the given file path. This option creates the username.tar.gz file, where username represents the account’s username.--backup=/usr/local/cpanel/backups
--skipacctdbExclude the account’s MySQL and PostgreSQL databases from the archive.--skipacctdb
--skipapitokensExclude the account’s API tokens from the archive.--skipapitokens
--skipauthlinksExclude the account’s external authentication credentials from the archive.--skipauthlinks
--skipbwdataExclude the account’s bandwidth data from the archive.--skipbwdata
--skipdnszonesExclude the account’s DNS zone file information from the archive.--skipdnszones
--skipdomainsExclude the account’s subdomains, parked domains (aliases), and addon domains from the archive.--skipdomains
--skipftpusersExclude the account’s FTP user accounts from the archive.--skipftpusers
--skiphomedirExclude the account’s /home directory from the archive. Use this option if you will save or transfer the /home directory with another method, such as the rsync command.--skiphomedir
--skipintegrationlinksExclude the account’s integration links from the archive.--skipintegrationlinks
--skiplinkednodesExclude the account’s server node linkages from the archive.--skiplinkednodes
--skiplocaleExclude the account’s locale information or customized locale from the archive.--skiplocale
--skiplogsExclude the account’s log files from the archive.--skiplogs
--skipmailExclude the account’s mail directory from the archive.--skipmail
--skipmailconfigExclude the account’s mail configuration information from the archive.--skipmailconfig
--skipmailmanExclude the account’s Mailman mailing lists from the archive.--skipmailman
--skipmysqlExclude the account’s MySQL databases, database users, and database grants from the archive.--skipmysql
--skippasswdExclude the account’s password from the archive.--skippasswd
--skippgsqlExclude the account’s PostgreSQL databases, database users, and database grants from the archive.--skippgsql
--skippublichtmlExclude the account’s /public_html directory.--skippublichtml
--skipquotaExclude the account’s disk quota limits from the archive.--skipquota
--skipresellerconfigExclude the account’s reseller privileges from the archive.--skipresellerconfig
--skipshellExclude the account’s shell information and privileges from the archive.--skipshell
--skipsslExclude the server’s SSL certificates and files in the Apache® configuration. This option does not exclude the SSL files in the account’s /home directory.--skipssl
--skipuserdataExclude the account’s subaccount information. You create these accounts in cPanel’s User Manager interface (cPanel >> Home >> Preferences >> User Manager).--skipuserdata
--helpDisplay a brief help message.--help
--manDisplay the script’s full documentation.--man

source: https://support.cpanel.net/hc/en-us/articles/360051760834-How-to-run-a-manual-backup

Tags: ,