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-Manager: write vhost.conf upon (Sub-) Domain-Creation

Discussion in 'Plesk 9.x for Linux Issues, Fixes, How-To' started by TorbenB, May 28, 2009.

  1. TorbenB

    TorbenB Guest

    0
     
    Hi,

    I tried to create a vhost.conf upon creating an new domain or subdomain.

    Below is an example of handling the creation of a new subdomain, which I need to do the following:
    1. create Folder "conf" for Subdomain
    2. write Directives for open_basedir into "conf/vhost.conf"
    3. TEST: write same to a temporary File (/tmp/eventLog.txt)

    When I create a subdomain the following happens:
    - no vhost.conf is written
    - the first to outputs are written to some file called "/tmp/eventLog.txt?"
    - "</Directory>" is written correctly to "/tmp/eventLog.txt"

    Would be great if someone has an idea or a solution :)

    Regards,
    Torben


    Event: Sudomain-Creation
    Priority: 0
    User: root

    Command:

    #!/bin/bash
    mkdir "/srv/www/vhosts/${NEW_DOMAIN_NAME}/subdomains/${NEW_SUBDOMAIN_NAME}/conf"
    echo "<Directory /srv/www/vhosts/${NEW_DOMAIN_NAME}/subdomains/${NEW_SUBDOMAIN_NAME}/httpdocs>" >> /srv/www/vhosts/${NEW_DOMAIN_NAME}/subdomains/${NEW_SUBDOMAIN_NAME}/conf/vhost.conf
    echo " php_admin_value open_basedir \"/srv/www/vhosts/${NEW_DOMAIN_NAME}/subdomains/${NEW_SUBDOMAIN_NAME}/httpdocs:/srv/www/public:/tmp\"" >> /srv/www/vhosts/${NEW_DOMAIN_NAME}/subdomains/${NEW_SUBDOMAIN_NAME}/conf/vhost.conf
    echo "</Directory>" >> /srv/www/vhosts/${NEW_DOMAIN_NAME}/subdomains/${NEW_SUBDOMAIN_NAME}/conf/vhost.conf

    echo "<Directory /srv/www/vhosts/${NEW_DOMAIN_NAME}/subdomains/${NEW_SUBDOMAIN_NAME}/httpdocs>" >> /tmp/eventLog.txt
    echo " php_admin_value open_basedir \"/srv/www/vhosts/${NEW_DOMAIN_NAME}/subdomains/${NEW_SUBDOMAIN_NAME}/httpdocs:/srv/www/public:/tmp\"" >> /tmp/eventLog.txt
    echo "</Directory>" >> /tmp/eventLog.txt
     
Loading...