• 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.

Question List of domains under a subscription

Dave W

Regular Pleskian
Hello all,

Is there a way to get a list of domains hosted on a subscription from the plesk db on CLI?

We have to move alot of subscriptions and need to implement this "workaround" for all the domains that will be moved.

Regards
Dave
 
It depends on what you have to start with. For example, if you know the subscription name and want to get a list of the domains of that subscription, you could run an SQL query on the psa database like

Code:
select a.name AS domainname
FROM domains AS a
inner join hosting  AS b ON b.dom_id = a.id
inner join sys_users AS c ON c.id = b.sys_user_id
where c.login LIKE '<name of subscription>'

This will include all subdomains of the subscription, too.
To run the query, either enter the "plesk db" database interface or run it directly as a command from the console:

Code:
# plesk db "select a.name AS domainname FROM domains AS a inner join hosting  AS b ON b.dom_id = a.id inner join sys_users AS c ON c.id = b.sys_user_id where c.login LIKE '<name of subscription>'"

Replace "<name of subscription>" with the subscription's name.
 
Hey Peter,

Almost there :)

Code:
 plesk db "select a.name AS domainname FROM domains AS a inner join hosting  AS b ON b.dom_id = a.id inner join sys_users AS c ON c.id = b.sys_user_id where c.home LIKE '%<subscription name%'"
 
Just been poking about with this;

The code above wont list domains that have no hosting, just DNS hosting.
 
Last edited:
Back
Top