• 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
  • Inviting everyone to the UX test of a new security feature in the WP Toolkit
    For WordPress site owners, threats posed by hackers are ever-present. Because of this, we are developing a new security feature for the WP Toolkit. If the topic of WordPress website security is relevant to you, we would be grateful if you could share your experience and help us test the usability of this feature. We invite you to join us for a 1-hour online session via Google Meet. Select a convenient meeting time with our friendly UX staff 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