.pdf)
WHM Plugins
/scripts/ directory. To pass data to the script, pass the data via @ARGV. These scripts are always executed by the root user.
| Script (located in /scripts) |
Arguments | Description |
|---|---|---|
postcpbackup |
None | Runs after cPanel backup (post /scripts/cpbackup). |
prekillacct |
See below | Runs before account termination (pre /scripts/killacct). |
postkillacct |
See below | Runs after account termination (post /scripts/killacct). Note: Parse as a hash as killdns or user could change order. |
presuspendacct |
|
Runs before an account is suspended (pre /scripts/suspendacct). |
postsuspendacct |
|
Runs after an account is suspended (post /scripts/suspendacct). |
preunsuspendacct |
|
Runs before an account is unsuspended (pre /scripts/unsuspendacct). |
preupcp |
None | Runs before cPanel & WHM updates (post /scripts/upcp). |
postupcp |
None | Runs after cPanel & WHM updates (post /scripts/upcp). |
postupdateuserdomains |
None | Runs after generation of the domain list (post /scripts/updateuserdomains). |
postunsuspendacct |
|
Runs after an account is unsuspended (post /scripts/unsuspendacct). |
prepkgacct |
|
Runs before an account is packaged into a cpmove file by means of the /scripts/enXim-pkgacct script (typically during the transfer of an account from the Ensim® control panel to a cPanel & WHM server). |
postpkgacct |
|
Runs after an account is packaged into a cpmove file by means of the /scripts/enXim-pkgacct script (typically during the transfer of an account from the Ensim control panel to a cPanel & WHM server). |
prerestoreacct |
|
Runs before an account is restored. (pre /scripts/restoreacct) |
postrestoreacct |
|
This script runs after an account is restored. (post /scripts/restoreacct) |
prewwwacct |
See below | Runs before account creation (pre /scripts/wwwacct). |
postwwwacct |
See below | Runs after account creation (post /scripts/wwwacct). |
postwwwacctuser |
|
Runs after user creation. |
premodifyacct |
See below | Runs before an account is modified. |
postmodifyacct |
See below | Runs after an account is modified. |
prewwwacct) or after ( postwwwacct) an account is created.
Within these scripts, a hash is passed via ARGV to the hook script, consisting of the following data: user
domain.tld
reseller_gold
0 is unlimited.
p@ss!w0rd$123
y — yes.
n — no.
y — yes.
n — no.
y — yes.
n — no.
y — yes.
n — no.
user@otherdomain.tld
x3
unlimited, and null
0 is unlimited.
unlimited, and null
0 is unlimited.
unlimited, and null
0 is unlimited.
unlimited, and null
0 is unlimited.
unlimited, and null
0 is unlimited.
unlimited, and null
0 is unlimited.
unlimited, and null
0 is unlimited.
unlimited, and null
0 is unlimited.
1 — yes.
0 — no.
postwwwacct or prewwwacct, read the converting hashes passed via ARGV section.
premodifyacct) or after ( postmodifyacct) an account is modified.
| Script (located in /scripts) |
Description |
|---|---|
QUOTA |
Disk space quota |
HASCGI |
Whether CGI privileges are enabled |
HASSPF |
Whether SPF is enabled |
MAXSUB |
Maximum amount of subdomains the user can create |
MAXAADON |
Maximum amount of addon domains the user can create |
MAX_DEFER_FAIL_PERCENTAGE |
Maximum percentage of failed or deferred messages a domain may send per hour |
HASDKIM |
Whether the account has DKIM enabled |
HASSHELL |
Whether the domain has shell access enabled |
newuser |
Used to change an existing user name |
contactemail |
Contact email address for the account |
domain |
Primary domain for the account |
user |
User name for the account |
RS |
Theme desired for the account |
MAX_EMAIL_PER_HOUR |
Maximum amount of emails relayed by the domain per hour |
reseller |
Reseller privileges of the account |
MAXFTP |
Maximum amount of FTP accounts the user can create |
MAXMONGREL |
Maximum amount of mongrel instances (Ruby on Rails) |
LOCALE |
Default locale of the account |
MAXLST |
Maximum amount of mailing lists the user can create |
MAXPARK |
Maximum amount of parked domains the user can create |
BWLIMIT |
Bandwidth limit of the account |
MAXPOP |
Maximum number of email accounts the user can create |
MAXSQL |
Maximum amount of SQL databases for the account |
OWNER |
Owner of the account |
/scripts/postkillacct %OPTSParameters:
OPTS{'user'} — The username of the terminated account.
OPTS{'killdns'} — Whether the zone files were deleted during account termination. This is a boolean variable, and it will either be 1 (yes) or 0 (no).
| Script (located in /scripts) |
Description |
|---|---|
precourierup |
Runs before Courier updates (pre /scripts/courierup) |
postcourierinstall |
Runs after Courier updates (post /scripts/courierup) |
postcourierup |
Runs after Courier updates (post /scripts/courierup) |
postcourier-authlibup |
Runs after courier-authlib package updates |
postcourier-imapup |
Runs after courier-imap package updates |
predovecotup |
Runs before Dovecot updates (pre /scripts/dovecotup) |
postdovecotup |
Runs after Dovecot updates (post /scripts/dovecotup) |
predovecotup |
Runs before Dovecot updates (pre /scripts/dovecotup) |
preeximup |
Runs before Exim updates (pre /scripts/eximup) |
posteximup |
Runs after Exim updates (post /scripts/eximup) |
preftpup |
Runs before FTP updates (pre /scripts/ftpup) |
postftpinstall |
Runs after FTP server updates (post /scripts/ftpup) |
postftpup |
Runs after FTP server updates (post /scripts/ftpup) |
premysqlup |
Runs before MySQL updates (pre /scripts/mysqlup) |
postmysqlinstall |
Runs after MySQL updates (post /scripts/mysqlup) |
postmysqlup |
Runs after MySQL updates (post /scripts/mysqlup) |
prensdup |
Runs before NSD updates (pre /scripts/nsdup) |
postnsdup |
Runs after NSD updates (post /scripts/nsdup) |
ARGV. This means that the script will be called from the command line in a similar method to:
/scripts/$hookname user $user password $password
You will need to convert the ARGV hash into a usable data structure (see below).
Now,my %OPTS = @ARGV
%OPTS will be a normal Perl hash containing the data, so it can be accessed as follows:
my $username = $OPTS{'user'};
$username will now contain the value of $user.
$argv and convert it into an associative array for PHP.
function argv2array ($argv) { $opts = array(); $argv0 = array_shift($argv);
while(count($argv)) { $key = array_shift($argv); $value = array_shift($argv); $opts[$key] = $value; } return $opts; }
When you call this function, you need to pass $argv to it:
Now, you can access the username like so:$opts = argv2array($argv);
$opts['user'];