• 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 Manager - Create DB when domain created

D

Deleted member 190513

Guest
Hello,

I'm trying to automate the creation of a database whenever a domain is created, but I cannot seam to get it to work. I'm missing the part where I fetch the subscriber for which the new domain is created.
.
I'm running this line:
plesk bin database -c ${NEW_DOMAIN_NAME} -domain ${HOW-TO-GET-SUBSCRIBER} -type mysql -server localhost

As you can see, I don't know how to get the subscriber. I've been looking at every article I can get my hands on. How do I do this?
 
Hello,
You don't need domain subscriber for this command actually as -domain parameter expects domain name to be specified. So for creating database try running:
Code:
plesk bin database -c 'db_name' -domain ${NEW_DOMAIN_NAME} -type mysql -server localhost
 
Hello,
You don't need domain subscriber for this command actually as -domain parameter expects domain name to be specified. So for creating database try running:
Code:
plesk bin database -c 'db_name' -domain ${NEW_DOMAIN_NAME} -type mysql -server localhost

Thank you for the suggestion, but I've already tried that - and it doesn't seam to work. See the images below.

2019-05-23 09-48-11.png err2.png
 
Sorry, this example will work for Default domain (the first domain added to a subscription) created event only.
For additional domains you will have to retrieve default domain (webspace) name, for example using API: you can get webspace ID first and then webspace name.
 
Back
Top