Answers.Body: <p>There are two existing console commands you can use, <code>./craft on</code> and <code>./craft off</code> (<a href="https://craftcms.com/docs/3.x/console-commands.html#on" rel="nofollow noreferrer">on</a> and <a href="https://craftcms.com/docs/3.x/console-commands.html#off" rel="nofollow noreferrer">off</a>).</p>
  <p>If you want/need to implement your own, take a look at <a href="https://github.com/craftcms/cms/commit/e919ea1a5bd36a9165c6539488c74f263090ded4" rel="nofollow noreferrer">the commit</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-30T15:38:03.027Z
Answers.Text: I didn't even think to look at Craft's own console commands :facepalm: thanks!! And also thank you for posting the link to that commit! :)
Answers.UserDisplayName: Steven Thate
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-30T12:41:38.807Z
Answers.LastActivityDate: 2020-12-30T12:41:38.807Z
Answers.UserDisplayName: Oli
Body: <p>I have a console controller action that needs to change the site's status under certain conditions. I have not been able to find any documentation or even questions out there about how to do this. Is it even possible?</p>
  
Tags: <system-status>
Title: How can I programmatically change the system's status?
ThreadText: # How can I programmatically change the system's status?
  
  (Asked by: username_0 on 2020-12-29)
  
  I have a console controller action that needs to change the site's status under certain conditions. I have not been able to find any documentation or even questions out there about how to do this. Is it even possible?
  
  **Tags:** system-status
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-12-30. Score: 3 | Accepted answer
  
  There are two existing console commands you can use, `./craft on` and `./craft off` ([on](https://craftcms.com/docs/3.x/console-commands.html#on) and [off](https://craftcms.com/docs/3.x/console-commands.html#off)).
  
  If you want/need to implement your own, take a look at [the commit](https://github.com/craftcms/cms/commit/e919ea1a5bd36a9165c6539488c74f263090ded4).
  
  > **Comments:**
  > **username_0**: I didn't even think to look at Craft's own console commands :facepalm: thanks!! And also thank you for posting the link to that commit! :)  
  
  ---
  
  