/scripts/ directory. If any data is passed into the script, it will be passed 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 |
<username> <reason> |
Runs before an account is suspended (pre /scripts/suspendacct). |
postsuspendacct |
<user> <reason> | Runs after an account is suspended (post /scripts/suspendacct). |
preunsuspendacct |
<username> | 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 |
<user> | Runs after an account is unsuspended (post /scripts/unsuspendacct). |
prewwwact |
See below. | Runs before account creation (pre /scripts/wwwacct). |
postwwwacctuser |
<user> | Runs after user creation; displays the new user's name. |
postwwwacct |
See below. | Runs after account creation (post /scripts/wwwacct). |
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, please see the section on converting hashes passed via ARGV.
/scripts/postkillacct %OPTSParameters:
OPTS{'user'} — Username of the terminated account.
OPTS{'killdns'} — Whether the zone files were deleted during account termination. This is a boolean variable and will either be 1 (yes) or 0 (no).
| Script (located in /scripts) |
Arguments | Description |
|---|---|---|
precourierup |
None | Runs before Courier updates (pre /scripts/courierup). |
postcourierinstall |
None | Runs after Courier updates (post /scripts/courierup). |
postcourierup |
None | Runs after Courier updates (post /scripts/courierup). |
postcourier-authlibup |
None | Runs after courier-authlib package updates). |
postcourier-imapup |
None | Runs after courier-imap package updates). |
predovecotup |
None | Runs before Dovecot updates (pre /scripts/dovecotup). |
postdovecotup |
None | Runs after Dovecot updates (post /scripts/dovecotup). |
predovecotup |
None | Runs before Dovecot updates (pre /scripts/dovecotup). |
preeximup |
None | Runs before Exim updates (pre /scripts/eximup). |
posteximup |
None | Runs after Exim updates (post /scripts/eximup). |
preftpup |
None | Runs before FTP updates (pre /scripts/ftpup). |
postftpinstall |
None | Runs after FTP server updates (post /scripts/ftpup). |
postftpup |
None | Runs after FTP server updates (post /scripts/ftpup). |
premysqlup |
None | Runs before MySQL updates (pre /scripts/mysqlup). |
postmysqlinstall |
None | Runs after MySQL updates (post /scripts/mysqlup). |
postmysqlup |
None | Runs after MySQL updates (post /scripts/mysqlup). |
prensdup |
None | Runs before NSD updates (pre /scripts/nsdup). |
postnsdup |
None | Runs after NSD updates (post /scripts/nsdup). |
ARGV, meaning that the script will be called from the command line in a similar method to:
/scripts/$hookname user $user password $password
This will need to be converted into a usable data structure (see below).
my %OPTS = @ARGVNow
%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.
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 calling this, it needs to be passed $argv. So, you will call it as follows:
$opts = argv2array($argv);Now, you can access the username like so:
$opts[‘user’];
Copyright © cPanel 2000-2009.