Child pages
  • Guide to Standardized Hooks - PkgAcct Functions
Skip to end of metadata
Go to start of metadata

Introduction


The PkgAcct category's events occur during backup creation.

Create


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

Available Stages:

  • pre — Hook action code runs before the /scripts/pkgacct script collects or writes data.
  • preFinalize — Hook action code runs before the system compresses or transfers the cpmove file.
  • postFinalize — Hook actions code runs after the system compresses or transfers the cpmove file.

Note:

The postFinalize stage does not occur if the skiphomedir value is 1

Action Code Runs As:

  • During transfers, the root user.
  • While the system generates backup files, the user who owns the backup.

Blocking Attribute:

Escalate Privileges Attribute:

Returns

Note:

The chosen stage determines the event's output. Select the appropriate tab to view output parameters for that stage. 

ParameterTypeDescriptionPossible valuesExample
workdirstring

The temporary working directory that the system uses to build the cpmove archive.

A valid directory path.workingdir
homedirstring

The 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
ParameterTypeDescriptionPossible valuesExample
workdirstring

The temporary working directory that the system uses to build the cpmove archive.

A valid directory path.workingdir
homedirstring

The 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
ParameterTypeDescriptionPossible valuesExample
workdirstring

The temporary working directory that the system uses to build the cpmove archive.

A valid directory path.workingdir
homedirstring

The 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 — Will generate.
  • 0 — Will not generate.
1
is_backupBooleanWhether the archive is a backup.
  • 1 — Backup.
  • 0 — Not a backup.
1
tarballstring

The tarball's path.

Note:

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
md5suminteger

The tarball's md5sum value.

Note:

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.

Available Stages:

  • pre — Hook action code runs before the /usr/local/cpanel/scripts/restorepkg script restores the cpmove file.
  • preRestore — Hook action code runs before the system restores the cpmove file.
  • postRestore — Hook actions code runs after the system restores the cpmove file.

Note:

The postRestore stage does not occur if the skiphomedir value is 1

Action Code Runs As:

  • During restoration, the root user.
  • While the system restores backup files, the user who owns the backup.

Blocking Attribute:

Escalate Privileges Attribute:

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
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
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