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

How to setup event handler to change default permissions

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by sflc2000, Jul 15, 2009.

  1. sflc2000

    sflc2000 Guest

    0
     
    Am attempting to setup an Event Handler to execute upon Domain Creation to change the permissions of the /httpdocs and /httpsdocs folders, using Plesk 9.2.x on a dedicated Linux server.

    The script works from the shell command line, however it does not seem to be executing when creating a new domain in Plesk.

    Event settings...

    Event: Domain created
    Priority: lowest (0) * also tried highest (100)
    User: root * also tried user psaadm (plesk)
    Command: /usr/local/psa/admin/plib/modules/test-domain-created-handler.sh <new_domain_name>

    The script:

    #!/bin/bash
    echo "--------------" >> /tmp/event_handler.log
    /bin/date >> /tmp/event_handler.log
    /usr/bin/id >> /tmp/event_handler.log
    echo "domain created" >> /tmp/event_handler.log
    echo "name: $1" >> /tmp/event_handler.log
    chmod 0775 /var/www/vhosts/$1/httpdocs
    echo "chmod 0775" >> /tmp/event_handler.log
    echo "--------------" >> /tmp/event_handler.log

    File: -rwxr-xr-x 1 root root test-domain-created-handler.sh

    When I add a new domain via Plesk, the script outputs to the /tmp/event_hanlder.log file, but the permissions remain 750 (defaults).

    Found examples in the Plesk documentation and read / followed the directions. I also referred to this post in a Plesk 8.x forum, which also links to the documentation sample: http://forum.parallels.com/showthread.php?t=91221

    Not sure if it's related to the user set to run the script or the script's permissions itself.

    Any help appreciated, thanks!
     
  2. sflc2000

    sflc2000 Guest

    0
     
    Update --- got it to work, changed the event to get handled to "Physical hosting created".

    The flow -> create domain, then create hosting..., so just had to figure out where to have the event script triggered.
     
Loading...