The pkgacct Script

Valid for versions 88 through the latest version

Version:

82

88


Last modified: March 24, 2020

Overview

You can use the /usr/local/cpanel/scripts/pkgacct script to create a cpmove archive for an account. After you create the cpmove archive, you can transfer the account between servers.

Run the script

To use this script, run the following command as the root user:

/usr/local/cpanel/scripts/pkgacct [options] username destination
Notes:
  • In this example, username represents the username of the cPanel account for which to create a cpmove archive.

    • Pass this value after any options and before the destination path.

    • You cannot back up the root user.

  • In this example, destination represents the path to the directory in which you wish to store the cpmove archive.

    • This value is optional.

    • You must pass this value after the username.

  • The /usr/local/cpanel/scripts/pkgacct script does not use the cpbackup-exclude.conf file to exclude files or directories from backups.

  • When you package an account for transfer, the source and destination servers must contain sufficient free disk space. Both servers must contain free disk space greater than twice the size of the largest account to transfer and an additional 1GB of free disk space. The package and restore processes use this free space to store temporary files.

  • The system will not transfer any email addresses from Plesk to cPanel & WHM that contain a plus sign (+) in the email username.

Options

This script accepts the following options:

Option Description
--allow-override Use the /var/cpanel/lib/Whostmgr/Pkgacct/pkgacct file to package the account, if it exists.
Note:
Pass this option before any other options (in the 0th position).
--mysql=VERSION Specify the version of MySQL® that the account’s databases use.
--roundcube=VERSION Specify the version of Roundcube that the account uses.
--dbbackup=TYPE Specify the database backup type 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. You should only use this option if you back up your databases through a different method, but you wish to track a database’s users.
  • name — The script only backs up the database names. MySQL databases will transfer as placeholders that contain a CREATE TABLE command. PostgreSQL® databases will transfer as empty .tar placeholder files.
--dbbackup_mysql=TYPE An 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.
--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 cpmove archive. This option may speed up the backup process.
--incremental Update the destination file with any new content since the previous backup and remove 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 automatically declares the --nocompress option in order to create an uncompressed archive.
--split Create the cpmove archive in chunks. This option reduces the overall load on the system.
--nocompress Do not compress the cpmove archive.
--compress Override the --nocompress option, if it exists.
Note:
The /usr/local/cpanel/scripts/pkgacct script compresses archives by default.
--userbackup Allow the user to use the cpmove archive as a backup for the account.
--backup Use the cpmove archive as a backup for the account.
Notes:
  • If you pass this option, you must pass a destination.
  • This option creates the username.tar.gz file, where username represents the account’s username.
--skipacctdb Exclude the account’s databases from the cpmove archive.
Note:
This option is an alias for the --skipmysqldb and --skippgsqldb options.
--skipapitokens Exclude the account’s API tokens.
--skipauthlinks Exclude the account’s external authentication credentials from the archive.
--skipbwdata Exclude the account’s bandwidth data from the archive.
--skipdnszones Exclude the account’s DNS zone file information from the archive.
--skipdomains Exclude the account’s subdomains, parked domains (aliases), and addon domains from the archive.
--skipftpusers Exclude the account’s FTP user accounts from the archive.
--skiphomedir Exclude the account’s home directory from the archive.
Note:
Use this option if you will save or transfer the home directory with another method, such as the rsync command.
--skipintegrationlinks Exclude the account’s integration links from the archive.
--skiplinkednodes Exclude the account’s server node linkages from the archive.
--skiplocale Exclude the account’s locale information or customized locale from the archive.
--skiplogs Exclude the account’s log files from the archive.
--skipmail Exclude the account’s mail directory from the archive.
--skipmailconfig Exclude the account’s mail configuration information from the archive.
--skipmailman Exclude the account’s Mailman mailing lists from the archive.
--skipmysql Exclude the account’s MySQL databases, database users, and database grants from the archive.
Note:
If you pass the --skipacctdb option, the --skippgsql option becomes redundant.
--skippasswd Exclude the account’s password from the archive.
--skippgsql Exclude the account’s PostgreSQL databases, database users, and database grants from the archive.
Note:
If you pass the --skipacctdb option, the --skippgsql option becomes redundant.
--skippublichtml Exclude the account’s public_html directory.
--skipquota Exclude the account’s disk quota limits from the archive.
--skipresellerconfig Exclude the account’s reseller privileges from the archive.
--skipshell Exclude the account’s shell information and privileges from the archive.
--skipssl Exclude SSL certificates and files that the server’s Apache configuration contains. It does not exclude SSL files that the account’s home directory contains.
--skipuserdata Exclude the account’s subuser information.
--serialized_output Encode each line of the script’s output in JSON format in order to allow the live_tail_log.cgi script to stream it.
--help Display a brief help message.
--man Display the script’s full documentation.

Create a cpmove archive for an account

To use a custom packaging script, perform the following steps:

  1. As the root user, copy the /usr/local/cpanel/scripts/pkgacct file and modify it.

  2. Store the modified pkgacct file in the /var/cpanel/lib/Whostmgr/Pkgacct/pkgacct directory.

  3. Run the /usr/local/cpanel/bin/backup --allow-override command.

Additional Documentation