1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Event handler doesn't work in 10.4.4

Discussion in 'Plesk 10.x for Linux Issues, Fixes, How-To' started by Matthew James, Nov 15, 2011.

  1. Matthew James

    Matthew James Basic Pleskian

    21
    73%
    Joined:
    Dec 7, 2009
    Messages:
    71
    Likes Received:
    1
    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
     
  2. SibProgrammer

    SibProgrammer Regular Pleskian Staff Member

    29
     
    Joined:
    Nov 21, 2004
    Messages:
    342
    Likes Received:
    15
    "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".
     
  3. Matthew James

    Matthew James Basic Pleskian

    21
    73%
    Joined:
    Dec 7, 2009
    Messages:
    71
    Likes Received:
    1
    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
     
  4. SibProgrammer

    SibProgrammer Regular Pleskian Staff Member

    29
     
    Joined:
    Nov 21, 2004
    Messages:
    342
    Likes Received:
    15
    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
    )
     
  5. auroranetwork

    auroranetwork New Pleskian

    22
    23%
    Joined:
    Jan 5, 2009
    Messages:
    6
    Likes Received:
    0
    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: Dec 21, 2011
  6. SibProgrammer

    SibProgrammer Regular Pleskian Staff Member

    29
     
    Joined:
    Nov 21, 2004
    Messages:
    342
    Likes Received:
    15
    The same event on Win have strange name "Website created". But this is what you're looking for.
     
Loading...