• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • 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.

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