To add an Event Handler:
For instance, let's create an event handler for the 'client account creation' event. The handler will accept a client name as the first parameter, and the client's login as the second. For simplicity we will use a batch file called test-handler.bat that looks as follows:
echo "--------------" >> c:\windows\temp\event_handler.log
rem information on the event date and time
date /T >> c:\windows\temp\event_handler.log
rem information on the created client account
echo "client created" >> c:\windows\temp\event_handler.log
rem client's name
echo "name: %1" >> c:\windows\temp\event_handler.log
rem client's login
echo "login: %2" >> c:\windows\temp\event_handler.log
echo "--------------" >> c:\windows\temp\event_handler.log
This script prints some information to a file so that we could control its execution.
Suppose, that our script is located in the directory c:\program files\swsoft\plesk\scripts\. Let's register it by creating an event handler via the control panel:
When assigning several handlers to a single event you can specify the handler execution sequence, setting different priorities (higher value corresponds to a higher priority).
c:\program files\swsoft\plesk\scripts\test-handler.bat" <new_contact_name> <new_login_name>.Note that if directory names or the file name contains spaces, the path should be quoted.
Note: In the command we have specified the parameters in the angle brackets <new_contact_name> and <new_login_name>. Before executing the handler, they will be replaced with name and login of the created client respectively. The entire list of available parameters is provided below. You should keep in mind that with the removal operations, the parameters of type new_xxx contain an empty string. And with creation operations the parameters of type old_xxx contain an empty string.
Now if you login to your Plesk control panel and create a new client, specifying the value 'Some Client' in the Contact name field, and 'some_client' in the field Login, the handler will be invoked, and the following records will be added to the c:\windows\temp\event_handler.log:
Sat Jun 26 21:46:34 NOVT 2004
client created
name: Some client
login: some_client
If you want to specify one or few handlers more, repeat the actions above for another handler.
The events that can be processed by the Event Handler are listed in the Table 2.1.
Table 2.1
Event (action) name |
Description |
|---|---|
|
Client account created |
|
Client account updated |
|
Client account deleted |
|
Domain created |
|
Domain properties updated |
|
Domain deleted |
|
Subdomain created |
|
Subdomain properties updated |
|
Subdomain deleted |
|
Physical hosting created |
|
Physical hosting account updated |
|
Physical hosting account deleted |
|
Mail account created |
|
Mail account updated |
|
Mail account deleted |
|
Web user created |
|
Web user properties updated |
|
Web user account deleted |
|
Client limits updated |
|
Domain limits updated |
|
Mailing list created |
|
Mailing list updated |
|
Mailing list deleted |
|
User logged in to control panel |
|
User logged out of control panel |
|
Domain administrator properties updated |
|
Site application installed |
|
Site application reconfigured |
|
Information about site application removed from database; however, the application still functions on the domain |
|
Site application uninstalled |
|
Site application package added to application vault |
|
Site application package removed from application vault |
|
Additional administrator account created |
|
Additional administrator account updated |
|
Additional administrator account deleted |
|
FTP account created |
|
FTP account updated |
|
FTP account deleted |
|
Client permissions updated |
|
Service stopped |
|
Service started |
|
Service restarted |
|
Domain alias created |
|
Domain alias updated |
|
Domain alias deleted |
|
Connection to database server created |
|
Connection to database server updated |
|
Connection to database server deleted |
|
Remote DNS status updated |
The parameter templates that can be used when setting up an event handler are presented in Table 2.2.
Table 2.2
Component name/description |
Command line parameter |
Notes |
||||||
|---|---|---|---|---|---|---|---|---|
Old component value |
New component value |
|||||||
For the events 'Client account created', 'Client account updated', 'Client account removed' |
||||||||
Login Name |
old_login_name |
new_login_name |
required |
|||||
Password |
old_password |
new_password |
|
|||||
Contact Name |
old_contact_name |
new_contact_name |
required |
|||||
Company Name |
old_company_name |
new_company_name |
|
|||||
Phone |
old_phone |
new_phone |
|
|||||
Fax |
old_fax |
new_fax |
|
|||||
old_email |
new_email |
|
||||||
Address |
old_address |
new_address |
|
|||||
City |
old_city |
new_city |
|
|||||
State/Province |
old_state_province |
new_state_province |
|
|||||
Postal/ZIP Code |
old_postal_zip_code |
new_postal_zip_code |
|
|||||
Country |
old_country |
new_country |
|
|||||
For the events 'Domain created', 'Domain updated', 'Domain deleted' |
||||||||
Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
For the events 'Subdomain created', 'Subdomain updated', 'Subdomain deleted' |
||||||||
Subdomain Name |
old_subdomain_name |
new_subdomain_name |
required |
|||||
Parent Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
FTP account login |
old_system_user_type |
new_system_user_type |
|
|||||
Subdomain owner's login |
old_system_user |
new_system_user |
|
|||||
FTP account password |
old_system_user_password |
new_system_user_password |
|
|||||
Hard disk quota |
old_hard_disk_quota |
new_hard_disk_quota |
|
|||||
SSI support |
old_ssi_support |
new_ssi_support |
|
|||||
PHP support |
old_php_support |
new_php_support |
|
|||||
CGI support |
old_cgi_support |
new_cgi_support |
|
|||||
Perl support |
old_perl_support |
new_perl_support |
|
|||||
Python support |
old_python_support |
new_python_support |
|
|||||
ColdFusion support |
old_coldfusion_support |
new_coldfusion_support |
|
|||||
ASP support |
old_asp_support |
new_asp_support |
|
|||||
For the events 'Physical hosting created', 'Physical hosting updated' |
||||||||
Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
IP Address |
old_ip_address |
new_ip_address |
|
|||||
IP Type |
old_ip_type |
new_ip_type |
|
|||||
Domain Administrator login |
old_system_user |
new_system_user |
|
|||||
Domain Administrator password |
old_system_user_password |
new_system_user_password |
|
|||||
Access to system |
old_system_shell |
new_system_shell |
|
|||||
MS FrontPage Support |
old_fp_support |
new_fp_support |
|
|||||
MS FrontPage over SSL Support |
old_fpssl_support |
new_fpssl_support |
|
|||||
MS FrontPage Authoring |
old_fp_authoring |
new_fp_authoring |
|
|||||
MS FrontPage Admin Login |
old_fp_admin_login |
new_fp_admin_login |
|
|||||
MS FrontPage Admin Password |
old_fp_admin_password |
new_fp_admin_password |
|
|||||
SSI Support |
old_ssi_support |
new_ssi_support |
|
|||||
PHP Support |
old_php_support |
new_php_support |
|
|||||
CGI Support |
old_cgi_support |
new_cgi_support |
|
|||||
Perl Support |
old_perl_support |
new_perl_support |
|
|||||
Python support |
old_python_support |
new_python_support |
|
|||||
ColdFusion support |
old_coldfusion_support |
new_coldfusion_support |
|
|||||
ASP Support |
old_asp_support |
new_asp_support |
|
|||||
SSL Support |
old_ssl_support |
new_ssl_support |
|
|||||
Custom Error Documents |
old_custom_error_documents |
new_custom_error_documents |
|
|||||
Web Statistics |
old_web_statistics |
new_web_statistics |
|
|||||
Hard Disk Quota |
old_hard_disk_quota |
new_hard_disk_quota |
|
|||||
For the event 'Physical hosting deleted' |
||||||||
Domain Administrator login |
old_system_user |
new_system_user |
|
|||||
Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
For the events 'Mail account created', 'Mail account deleted' |
||||||||
Mail account |
old_mailname |
new_mailname |
required (in the format mailname@domain) |
|||||
For the event 'Mail account updated' |
||||||||
Mail account |
old_mailname |
new_mailname |
required (in the format mailname@domain) |
|||||
Mailbox |
old_mailbox |
new_mailbox |
|
|||||
Password |
old_password |
new_password |
|
|||||
Mailbox Quota |
old_mailbox_quota |
new_mailbox_quota |
|
|||||
Redirect |
old_redirect |
new_redirect |
|
|||||
Redirect Address |
old_redirect_address |
new_redirect_address |
|
|||||
Mail Group |
old_mail_group |
new_mail_group |
|
|||||
Autoresponders |
old_autoresponders |
new_autoresponders |
|
|||||
For the event 'Web user deleted' |
||||||||
Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
Web User Name |
old_webuser_name |
new_webuser_name |
required |
|||||
For the events 'Web user created', 'Web user updated' |
||||||||
Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
Web User Name |
old_webuser_name |
new_webuser_name |
required |
|||||
Web User Password |
old_webuser_password |
new_webuser_password |
|
|||||
SSI Support |
old_ssi_support |
new_ssi_support |
|
|||||
PHP Support |
old_php_support |
new_php_support |
|
|||||
CGI Support |
old_cgi_support |
new_cgi_support |
|
|||||
Perl Support |
old_perl_support |
new_perl_support |
|
|||||
Python Support |
old_python_support |
new_python_support |
|
|||||
ColdFusion support |
old_coldfusion_support |
new_coldfusion_support |
|
|||||
ASP Support |
old_sp_support |
new_asp_support |
|
|||||
Hard Disk Quota |
old_hard_disk_quota |
new_hard_disk_quota |
|
|||||
For the event 'Client limits updated' |
||||||||
Client Login Name |
old_login_name |
new_login_name |
required |
|||||
Maximum Number of Domains |
old_maximum_domains |
new_maximum_domains |
|
|||||
Maximum Amount of Disk Space |
old_maximum_disk_space |
new_maximum_disk_space |
|
|||||
Maximum Amount of Traffic |
old_maximum_traffic |
new_maximum_traffic |
|
|||||
Maximum Number of Web Users |
old_maximum_webusers |
new_maximum_webusers |
|
|||||
Maximum Number of Databases |
old_maximum_databases |
new_maximum_databases |
|
|||||
Maximum Number of Mailboxes |
old_maximum_mailboxes |
new_maximum_mailboxes |
|
|||||
Mailbox Quota |
old_maximum_mailbox_quota |
new_maximum_mailbox_quota |
|
|||||
Maximum Number of Mail Redirects |
old_maximum_mail_redirects |
new_maximum_mail_redirects |
|
|||||
Maximum Number of Mail Groups |
old_maximum_mail_groups |
new_maximum_mail_groups |
|
|||||
Maximum Number of Mail Autoresponders |
old_maximum_mail_autorespon ders |
new_maximum_mail_autorespon ders |
|
|||||
Maximum Number of Mailing Lists |
old_maximum_mail_lists |
new_maximum_mail_lists |
|
|||||
Maximum Number of Web Applications |
old_maximum_tomcat_web_appli cations |
new_maximum_tomcat_web_appli cations |
|
|||||
Expiration Date |
old_expiration_date |
new_expiration_date |
|
|||||
For the event 'Domain limits updated' |
||||||||
Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
Maximum Amount of Disk Space |
old_maximum_disk_space |
new_maximum_disk_space |
|
|||||
Maximum Amount of Traffic |
old_maximum_traffic |
new_maximum_traffic |
|
|||||
Maximum Number of Web Users |
old_maximum_webusers |
new_maximum_webusers |
|
|||||
Maximum Number of Databases |
old_maximum_databases |
new_maximum_databases |
|
|||||
Maximum Number of Mailboxes |
old_maximum_mailboxes |
new_maximum_mailboxes |
|
|||||
Mailbox Quota |
old_maximum_mailbox_quota |
new_maximum_mailbox_quota |
|
|||||
Maximum Number of Mail Redirects |
old_maximum_mail_redirects |
new_maximum_mail_redirects |
|
|||||
Maximum Number of Mail Groups |
old_maximum_mail_groups |
new_maximum_mail_groups |
|
|||||
Maximum Number of Mail Autoresponders |
old_maximum_mail_autorespon ders |
new_maximum_mail_autorespon ders |
|
|||||
Maximum Number of Mailing Lists |
old_maximum_mail_lists |
new_maximum_mail_lists |
|
|||||
Maximum Number of Web Applications |
old_maximum_tomcat_web_appli cations |
new_maximum_tomcat_web_appli cations |
|
|||||
Domain Expiration Date |
old_expiration_date |
new_expiration_date |
|
|||||
For the events 'Mailing list created', 'Mailing list updated', 'Mailing list deleted' |
||||||||
Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
Mailing list name |
old_mail_list_name |
new_mail_list_name |
required |
|||||
Mailing list switched on |
old_mail_list_enabled |
new_mail_list_enabled |
|
|||||
For the events 'Control panel user logged in', 'Control panel user logged out' |
||||||||
Contact Name |
old_contact_name |
new_contact_name |
|
|||||
For the event 'Domain administrator account updated' |
||||||||
Allow domain administrator access |
old_allow_domain_user_access |
new_allow_domain_user_access |
|
|||||
Login Name |
old_login_name |
new_login_name |
required |
|||||
Password |
old_password |
new_password |
required |
|||||
Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
Contact Name |
old_contact_name |
new_contact_name |
|
|||||
Company Name |
old_company_name |
new_company_name |
|
|||||
Phone |
old_phone |
new_phone |
|
|||||
Fax |
old_fax |
new_fax |
|
|||||
old_email |
new_email |
|
||||||
Address |
old_address |
new_address |
|
|||||
City |
old_city |
new_city |
|
|||||
State/Province |
old_state_province |
new_state_province |
|
|||||
Postal/ZIP Code |
old_postal_zip_code |
new_postal_zip_code |
|
|||||
Country |
old_country |
new_country |
|
|||||
For the events 'Client site application installed', 'Client site application uninstalled' |
||||||||
Client Login Name |
old_login_name |
new_login_name |
required |
|||||
For the events 'Site application package installed', 'Site application package uninstalled' |
||||||||
Site application package name |
old_site_application_package_ name |
new_site_application_package_ name |
required |
|||||
For the events 'IP address created', 'IP address updated' |
||||||||
IP address |
old_ip_address |
new_ip_address |
required |
|||||
IP mask |
old_ip_mask |
new_ip_mask |
|
|||||
Interface |
old_interface |
new_interface |
|
|||||
IP type |
old_ip_type |
new_ip_type |
|
|||||
For the events 'Forwarding created', 'Forwarding updated' |
||||||||
Domain name |
old_domain_name |
new_domain_name |
required |
|||||
IP address |
old_ip_address |
new_ip_address |
|
|||||
Forwarding type |
old_forwarding_type |
new_forwarding_type |
|
|||||
URL |
old_url |
new_url |
|
|||||
For the event 'Administrator information updated' |
||||||||
Login name |
old_login_name |
new_login_name |
required |
|||||
Contact name |
old_contact_name |
new_contact_name |
|
|||||
Company name |
old_company_name |
new_company_name |
|
|||||
Phone number |
old_phone |
new_phone |
|
|||||
Fax |
old_fax |
new_fax |
|
|||||
old_email |
new_email |
|
||||||
Address |
old_address |
new_address |
|
|||||
CIty |
old_city |
new_city |
|
|||||
State/Province |
old_state_province |
new_state_province |
|
|||||
Postal/Zip code |
old_postal_zip_code |
new_postal_zip_code |
|
|||||
Country |
old_country |
new_country |
|
|||||
For the events 'Site application installed, reconfigured, uninstalled' |
||||||||
Site application name |
old_package_name |
new_package_name |
required |
|||||
For the events 'Client status updated' |
||||||||
Contact name |
old_contact_name |
new_contact_name |
required |
|||||
Login name |
old_login_name |
new_login_name |
required |
|||||
Status |
old_status |
new_status |
|
|||||
For the events 'Client preferences updated' |
||||||||
Contact name |
old_contact_name |
new_contact_name |
required |
|||||
Login name |
old_login_name |
new_login_name |
required |
|||||
Interface skin |
old_interface_skin |
new_interface_skin |
|
|||||
For the event 'Client's IP pool updated' |
||||||||
Client login name |
old_login_name |
new_login_name |
required |
|||||
IP address |
old_ip_address |
new_ip_address |
required |
|||||
Status |
old_status |
new_status |
|
|||||
For the event 'Limit on disk space reached for the client account' |
||||||||
Contact name |
old_contact_name |
new_contact_name |
required |
|||||
Disk space limit |
old_maximum_disk_space |
new_maximum_disk_space |
required |
|||||
For the events 'Limit on traffic reached for the client account' |
||||||||
Contact name |
old_contact_name |
new_contact_name |
required |
|||||
Traffic limit |
old_maximum_traffic |
new_maximum_traffic |
|
|||||
For the events 'Domain status updated' |
||||||||
Domain name |
old_domain_name |
new_domain_name |
required |
|||||
Domain status |
old_status |
new_status |
|
|||||
For the event 'DNS zone updated for domain' |
||||||||
Domain name |
old_domain_name |
new_domain_name |
required |
|||||
For the event 'Limit on disk space reached for domain' |
||||||||
Domain name |
old_domain_name |
new_domain_name |
required |
|||||
Disk space limit |
old_maximum_disk_space |
new_maximum_disk_space |
|
|||||
For the event 'Limit on traffic reached for domain' |
||||||||
Domain name |
old_domain_name |
new_domain_name |
required |
|||||
Traffic limit |
old_maximum_traffic |
new_maximum_traffic |
|
|||||
For the event 'License key update' |
||||||||
License key number |
old_license |
new_license |
required |
|||||
License key type (Plesk, additional) |
old_license_type |
new_license_type |
|
|||||
License key name (for additional keys) |
old_license_name |
new_license_name |
|
|||||
For the events 'Additional administrator account created', 'Additional administrator account updated' |
||||||||
Login Name |
old_login_name |
new_login_name |
required |
|||||
Contact Name |
old_contact_name |
new_contact_name |
|
|||||
Password |
old_password |
new_password |
|
|||||
Account status |
old_status |
new_status |
|
|||||
old_email |
new_email |
|
||||||
For the events 'FTP account created', 'FTP account updated' |
||||||||
Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
FTP account name |
old_system_user |
new_system_user |
required |
|||||
FTP account password |
old_system_user_password |
new_system_user_password |
|
|||||
Hard Disk Quota |
old_hard_disk_quota |
new_hard_disk_quota |
|
|||||
Home Directory |
old_home_directory |
new_home_directory |
|
|||||
Read Permission |
old_read_permission |
new_read_permission |
|
|||||
Write Permission |
old_write_permission |
new_write_permission |
|
|||||
For the event 'FTP account removed' |
||||||||
FTP account name |
old_system_user |
new_system_user |
required |
|||||
Domain Name |
old_domain_name |
new_domain_name |
required |
|||||
For the event 'IP address deleted' |
||||||||
IP address |
old_ip_address |
new_ip_address |
required |
|||||
For the event 'Forwarding deleted' |
||||||||
Domain name |
old_domain_name |
new_domain_name |
required |
|||||
Forwarding type |
old_forwarding_type |
new_forwarding_type |
|
|||||
For the event 'Client permissions updated' |
||||||||
Client Login Name |
old_login_name |
new_login_name |
required |
|||||
For the events 'Domain alias created', 'Domain alias updated' |
||||||||
Domain status |
old_status |
new_status |
required |
|||||
For more information about using Event Handler, refer to Plesk SDK documentation available at SWsoft website (swsoft.com).