• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion
  • Please beaware of a breaking change in the REST API on the next Plesk release (18.0.62).
    Starting from Plesk Obsidian 18.0.62, requests to REST API containing the Content-Type header with a media-type directive other than “application/json” will result in the HTTP “415 Unsupported Media Type” client error response code. Read more here

Question Maintenance-Mode CLI

omexlu

Regular Pleskian
Hello,

What is the syntax to enable and disable the maintenance mode over SSH for a website?

And is it maybe necessary to 'sleep X' few seconds in a bash-script after the command?

Thanks in advance.
 
History of Changes

Code:
Websites maintenance mode

(*) subscription, site, subdomain utilities:
Deprecated option: -maintenance-mode. The Suspended website status is used instead (see the next change).

 

The Suspended status of websites

(*) subscription, site, subdomain utilities:
New command: --suspend.
 
Hello @IgorG

Thank you, what would be that command? Maybe to suspend multiple domains at once?
And a sleep X is needed maybe?

Thanks.
 
Maybe to suspend multiple domains at once?
Just use something like

# for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/bin/site --suspend $i; done
 
@IgorG

Hello,

This thread might be old but is it possible to disable more than 1 domain in one line like:
/usr/local/psa/bin/site --suspend domain1.tld domain2.tld

In this example maybe it is possible to avoid multiple services restarts?

Thanks.
 
is it possible to disable more than 1 domain in one line like
Try something like:

# for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/bin/site --suspend $i; done

statement "select name from domains" you can replace according to your needed conditions.
 
Try something like:

# for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/bin/site --suspend $i; done

statement "select name from domains" you can replace according to your needed conditions.

Thank you, but what if I don't want to take all domains from database and only need few specific domains?
 
OK I will give it a try, but is there not another possiblity without sql statement?

For a single domain it works without.

Thank you very much for always your help :)
 
what about create a textfile with the specified domain names you want one per line and write a script which read the textfile and do the requiered action/command per domain? There are a lot of examples around just google for it
 
Last edited:
Back
Top