Use horizon and set it to force running in maintenance mode
Issue with Laravel Scheduler in Maintenance Mode
I deployed an application in Laravel and attempted to run the schedule:run command through a cron job. Despite trying several approaches, the scheduler was not working. I even changed the PHP version, modified the cron job, and tried other potential solutions, but nothing seemed to work.
Root Cause:
Eventually, I discovered the issue: the application was in maintenance mode. While in maintenance mode, Laravel does not run any scheduled tasks.
My Concern:
I believe this behavior is problematic, especially when deploying an upgraded script and needing to check or run scheduled tasks. The scheduler should ideally run even in maintenance mode to avoid disruptions.
Question:
Is there any solution to allow scheduled tasks to run even when the application is in maintenance mode?
@ubedthaheem Set your queue runner command to force.
https://laravel.com/docs/11.x/queues#maintenance-mode-queues
Please or to participate in this conversation.