Skip to content
Last updated

Development Guides Home >> Guide to Standardized Hooks >> Hookable Events

Guide to Standardized Hooks - PkgAcct Functions

The PkgAcct category's events occur during backup creation.

Create

This event takes place when the /usr/local/cpanel/scripts/pkgacct script creates the cpmove archive.

Information

  • Action code runs as:
    • During transfers, the root user.
    • While the system generates backup files, the user who owns the backup.
  • Blocking attribute: Available.
  • Escalate privileges attribute: Unavailable.

Available stages

  • pre — Hook action code runs before the pkgacct script collects or writes data.
  • preFinalize – Hook action code runs before the system compresses or transfers the cpmove file.
  • postFinalize — Hook action code runs after the system compresses or transfers the cpmove file. This stage does not occur if the skiphomedir value is 1.

pre returns

ReturnTypeDescriptionPossible valuesExample
workdirstringThe temporary working directory that the system uses to build the cpmove archive.A valid directory path.workingdir
homedirstringThe user's home directory.A valid directory path./home/username
userstringThe user for whom the system will perform the backup.A valid username on the server.username

preFinalize returns

ReturnTypeDescriptionPossible valuesExample
workdirstringThe temporary working directory that the system uses to build the cpmove archive.A valid directory path.workingdir
homedirstringThe user's home directory.A valid directory path./home/username
userstringThe user for whom the system will perform the backup.A valid username on the server.username
is_incrementalBooleanWhether the archive is an incremental backup.
  • 1 — Incremental backup.
  • 0 — Not an incremental backup.
1
is_splitBooleanWhether the system split the archive into multiple files.
  • 1 — Split.
  • 0 — Not split.
1
is_tarballBooleanWhether the system will generate a tarball.
  • 1 — Will generate.
  • 0 — Will not generate.
1
is_backupBooleanWhether the archive is a backup.
  • 1 — Backup.
  • 0 — Not a backup.
1

postFinalize returns

ReturnTypeDescriptionPossible valuesExample
workdirstringThe temporary working directory that the system used to build the cpmove archive.A valid directory path.workingdir
homedirstringThe user's home directory.A valid directory path./home/username
userstringThe user for whom the system performed the backup.A valid username on the server.username
is_incrementalBooleanWhether the archive is an incremental backup.
  • 1 — Incremental backup.
  • 0 — Not an incremental backup.
1
is_splitBooleanWhether the system split the archive into multiple files.
  • 1 — Split.
  • 0 — Not split.
1
is_tarballBooleanWhether the system generated a tarball.
  • 1 — Generated a tarball.
  • 0 — Did not generate a tarball.
1
is_backupBooleanWhether the archive is a backup.
  • 1 — Backup.
  • 0 — Not a backup.
1
tarballstringThe tarball's path.

If the is_split value is 1 or the pkgacct script's $create_tarball variable is false, the system does not return this parameter.
A valid file path./home/username/backup.tar.gz
md5sumintegerThe tarball's md5sum value.

If the is_split value is 1 or the pkgacct script's $create_tarball variable is false, the system does not return this parameter.
A positive integer.595f44fec1e92a71d3e9e77456ba80d1

Restore

This event takes place when the /usr/local/cpanel/scripts/pkgacct script restores the cpmove archive.

Information

  • Action code runs as:
    • During restoration, the root user.
    • While the system restores backup files, the user who owns the backup.
  • Blocking attribute: Available.
  • Escalate privileges attribute: Unavailable.

Available stages

  • postExtract — Hook action code runs before the system restores the cpmove file. This stage does not occur if the skiphomedir value is 1.
  • post — Hook action code runs after the system restores the cpmove file.

postExtract returns

ReturnTypeDescriptionPossible valuesExample
userstringThe source for which the system restored the backup.The name of the account or the full path to the backup file.account_name
old_userstringThe user for whom the system performed the backup.A valid username on the server.username
user_homedirstringThe user's home directory to which the system restored the backup.A valid directory name./userhome
domainstringThe domain on which to restore the account.A valid domain on the server.example.com

post returns

ReturnTypeDescriptionPossible valuesExample
userstringThe source for which the system restored the backup.The name of the account or the full path to the backup file.account_name
old_userstringThe user for whom the system performed the backup.A valid username on the server.username
user_homedirstringThe user's home directory to which the system restored the backup.A valid directory name./userhome
domainstringThe domain on which to restore the account.A valid domain on the server.example.com