Automate Maintenance Mode in Cron same as Laravel

Hi All,

I am able to automate Maintenance Mode in Cron using php artisan down and php artisan up.

This works on a top level however I am no longer able to log in to the backend if laravel is down.

Is there a way that I can automate switching to Maintenance Mode in my October Theme while still being able to log into the backend?

Using php artisan down I see this:

Using Maintenace Mode in the backend I see this:

I’m assuming it’s a routing thing.

Thanks for any input

They use two different mechanisms. The Laravel one short circuits the bootstrapper entirely. The October one uses the database and allows admins to bypass.

I think we could introduce a programmatic way to enable maintenance mode via the database.

Perhaps using the october:util command

Thanks for the response @daftspunk, I guess what I’m asking is if there can be an equivalent console command to php artisan down for October maintenance mode that we can put in Cron.

Appreciate it’s not as simple as that. We’re still finding out stuff ourselves and will have a look at october:util. Thanks again.

1 Like

As a temporary measure, I’m making my own command. I can’t see any way to change maintenance mode setting using the model reference however. Any ideas?

Hey @Call2call

Just a heads up, we’ve added this to the next release:

The commands are php artisan october:util with:

  • maintenance on: Turn on CMS maintenance mode (backend admins keep access).
  • maintenance off: Turn off CMS maintenance mode.

Added in v4.3.3

1 Like

That looks perfect for our needs @daftspunk, thank you so much :+1: