• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Resolved Domain status disabled/suspended unclear

Pleskie

Regular Pleskian
Hi,

I want to use CLI/bash to be able to enable, disable or suspend a domain. I am also trying to write a bash script that shows all enabled/disabled/suspended domains.

There seems to be a problem with the domain status though, or maybe I am doing something wrong?

I use "sudo plesk bin site --info [site name]" command to get all domain info, and then I use grep to get the "Domain status".

If a site is enabled, the domain status is: OK
If a site is suspended, the domain status is: Domain was suspended by administrator.

BUT

If a site is disabled, the domain status is: Domain was suspended by administrator. <= This is the exact same status as for a suspended domain.

As you can see, a suspended site and a disabled site share the exact same status, while they are 2 different things.

So how should I check (in bash) if a site is disabled instead of suspended? Am I doing something wrong or is this a bug in Plesk maybe?
 
You could distinguish between suspended and disabled domain statuses with a query like this:

# plesk db "select d.name, dp.val from domains d left join dom_param dp on d.id=dp.dom_id where d.name='example.com' and dp.param='turnOffAction'"
 
Thank you Igor, that is really helpful!

Last question: when I execute the query (without d.name) I get to see some sort of visual 'table'. But all I actually need is the value of dp.val without the visualtable. In other words, I only need the word 'disable' or 'suspend'. Is that somehow possible? Or is the only way to accomplish this to check if the output of the query contains the word disable/suspend?
 
Just use --disable-column-names option like:

# plesk db --disable-column-names -e "select dp.val from domains d left join dom_param dp on d.id=dp.dom_id where d.name='example.com' and dp.param='turnOffAction'"
 
@IgorG

By the way ... is there also a query I could use to directly get the status OK or suspended?

Right now I use "sudo plesk bin site --info [site name]" command to get all domain info, and then I use grep to get the "Domain status".

Is there an easier/better way to do this by using a query?
 
is there also a query I could use to directly get the status OK or suspended?
In table 'domains' you can see 'status' field. It is 0 when domain is Active and 16 if domain Suspended or Disabled.
 
Back
Top