• 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

How to setup event handler to change default permissions

S

sflc2000

Guest
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!
 
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.
 
Back
Top