How To Run And Force cPanel Backup Using SSH

By backup tool in cPanel,  you can backup the entire system and accounts or specific accounts on local or remote destinations. The root administrator user can manage and schedule the backup by WHM interface. In addition, you can run cPanel backup to execute and force backup the system using SSH connection.

cPanel Backup Shell Commands

Run New cPanel Backup System via SSH

				
					/usr/local/cpanel/bin/backup
				
			

Force cPanel To Perform A New Backup Even Shows Up-To-Date

				
					/usr/local/cpanel/bin/backup --force
				
			

cPanel Legacy Backup System

				
					/usr/local/cpanel/scripts/cpbackup
				
			

Force cPanel To Perform A New Backup

				
					/usr/local/cpanel/scripts/cpbackup --force
				
			

All Manual Backup Script Options

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

  • Debug : Runs the backup in the foreground and prints its progress on the command line. Example :–debug
  • Allow Override:When the system performs the backup, use the pkgacct script in the the /var/cpanel/lib/Whostmgr/Pkgacct/pkgacct directory. Example : –allow-override
  • Force Option:Performs extra backup, even if the system already contains up-to-date backup data files. Example: –force
  • Help: Displays additional information.Example :–help

Run Script Backup For Single Account

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

To perform this single backup :

  • Log into your server via SSH as root. 
  • 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
				
			

Some of pkgacct Script Backup Options

  • USERNAME : Required The cPanel account username for which to create a cpmove archive. So you must pass this option after any options, but before the DIRECTORY option.
  • DIRECTORY:The 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.
  • –allow-override:Use the /var/cpanel/lib/Whostmgr/Pkgacct/pkgacct file to package the account, if it exists.
  • –mysql=VERSION:The archive’s required minimum version of MySQL®. For example,  –mysql=5.2.1
  • –roundcube=VERSION:The archive’s required minimum version of Roundcube. For example, –roundcube=3.0
  • –dbbackup=TYPE:With Types :all, schema ,name. For example, –dbbackup=all
  • –get_version: Display the version of the pkgacct script.
  • –use_backups: Use 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.
  • –incremental: Update 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. This option will pass the –nocompress option to create an uncompressed archive.
  • –split: Create 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.
  • –nocompress: Do not compress the archive.
  • –userbackup :Allow the user to use the archive as a backup file for the account.
  • –backup=FILEPATH: Use 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.

Share Article

Related Articles