• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Event handler doesn't work in 10.4.4

Matthew James

Basic Pleskian
Hi all,

It seems the event handler does not work at all in Plesk 10.4.4.

To test I made the following script (test.pl):

#!/usr/bin/perl
open TMP, '>/tmp/output.txt';
foreach (keys %ENV) {
print TMP "$_ = " . $ENV{$_} . "\n";
}
close TMP;

And used this script as the event handler command:

Event Priority User Command
Domain alias created highest(100) root /usr/bin/perl /path_to_script/test.pl

And no file /tmp/output.txt was created, if I run the command manually, it works fine.

This was tested on Domain alias created and Domain created.

Anybody have any ideas where I can see a log that might show why it's not working? There is nothing in panel.log. Has anybody else managed to get this working in 10.4.4?

Thanks
Matt
 
"Domain alias created" event handler works w/o any problems. I took your script, placed on my server, created event handler and went to hosting panel -> Websites & Domains -> Add New Domain Alias. After alias creation I see /tmp/output.txt file with the following content:

NEW_DOMAIN_ID = 5
OLD_DNS =
NEW_MAIL = true
OLD_STATUS =
NEW_TOMCAT = false
PWD = /opt/psa/admin/htdocs
NEW_DOMAIN_ALIAS_NAME = alias.dom
NEW_STATUS = 0
OLD_TOMCAT =
SHLVL = 1
NEW_DNS = true
_ = /opt/psa/admin/bin/event_handler
NEW_WEB = true
PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
OLD_MAIL =
OLD_WEB =
PHP_FCGI_MAX_REQUESTS = 10
OLD_DOMAIN_ALIAS_NAME =
OLD_DOMAIN_ID =
PHP_FCGI_CHILDREN = 3

"Domain created" event handler also works, but maybe you expect little different behavior. How to generate this event? Create subscription, go to hosting panel -> Websites & Domains -> Add New Domain. So this event will be generated only if you add additional domain to your subscription. If you need a hook for subscription/first domain creation, look for event named "Default domain (the first domain added to a subscription/webspace) created".
 
Hi,

Thanks for the reply.

Yes, I didn't realise there was now an option for the "Default domain" as you mentioned - this does indeed work with the perl script.

The problem is, if you call a PHP script it doesn't seem to work, whereas previous it used to.

Are you able to get any success with a PHP script?

Thanks
Matt
 
PHP scripts also work as expected.

Command: /usr/bin/php /root/test.php

Script content:
<?php
file_put_contents('/tmp/output.txt', print_r($_SERVER, true));
?>

Output file content after event generation:
Array
(
[NEW_STATUS] => 0
[NEW_WEB] => true
[OLD_STATUS] =>
[NEW_DNS] => true
[NEW_MAIL] => true
[OLD_WEB] =>
[NEW_TOMCAT] => false
[OLD_TOMCAT] =>
[OLD_DOMAIN_ALIAS_NAME] =>
[PHP_FCGI_CHILDREN] => 3
[PATH] => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[NEW_DOMAIN_ALIAS_NAME] => alias3.dom
[OLD_MAIL] =>
[PWD] => /opt/psa/admin/htdocs
[OLD_DNS] =>
[SHLVL] => 1
[NEW_DOMAIN_ID] => 5
[OLD_DOMAIN_ID] =>
[PHP_FCGI_MAX_REQUESTS] => 10
[_] => /opt/psa/admin/bin/event_handler
[PHP_SELF] => /root/test.php
[SCRIPT_NAME] => /root/test.php
[SCRIPT_FILENAME] => /root/test.php
[PATH_TRANSLATED] => /root/test.php
[DOCUMENT_ROOT] =>
[REQUEST_TIME] => 1321711611
[argv] => Array
(
[0] => /root/test.php
)

[argc] => 1
)
 
First domain when creating subscription

I can't find the event handler "Default domain (the first domain added to a subscription/webspace) created" in the list of events. I've Plesk 10.4.4 on Windows 2008 R2? Any tricks? Thanks!
 
Last edited:
Back
Top