• 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

Question Event handler?

bob231

Basic Pleskian
In case Plesk api creates a new subscription/domain with a specific service plan I want to automate that plesk/linux copy some webfiles and folders into the new httpdocs. What is the best way to do this?

I was thinking about the event "Domain created", but how to know if the specific service plan matched and only execute the command in that case?

Thanks, Bob
 
You can fetch additional details via XML-RPC API afterwards.

Here is the example of API call:
Code:
<packet>
  <webspace>
    <get>
      <filter>
        <id>11</id>
      </filter>
      <dataset>
        <gen_info/>
        <subscriptions/>
      </dataset>
    </get>
  </webspace>
</packet>

Response may look something like following:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.10.0">
  <webspace>
    <get>
      <result>
        <status>ok</status>
        <filter-id>11</filter-id>
        <id>11</id>
        <data>
          <gen_info>
            <cr_date>2017-07-06</cr_date>
            <name>admin.dom</name>
            <ascii-name>admin.dom</ascii-name>
            <status>0</status>
            <real_size>0</real_size>
            <owner-login>admin</owner-login>
            <dns_ip_address>10.58.108.108</dns_ip_address>
            <htype>vrt_hst</htype>
            <guid>1a292f67-47aa-4e99-99a1-36142c36d45e</guid>
            <vendor-guid>a26051b1-430c-4925-8b46-e487045e42cf</vendor-guid>
            <external-id/>
            <sb-site-uuid/>
            <description/>
            <admin-description/>
          </gen_info>
          <subscriptions>
            <subscription>
              <locked>false</locked>
              <synchronized>true</synchronized>
              <plan>
                <plan-guid>ae18b12f-af37-6dad-3219-9b5792b4a02c</plan-guid>
              </plan>
            </subscription>
          </subscriptions>
        </data>
      </result>
    </get>
  </webspace>
</packet>

So in case if subscription is created on particular service plan, node "subscriptions" will be present in the response. In case of "custom" subscription (no plan assignment) the node "subscriptions" will be absent.
 
Back
Top