• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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