• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

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