The most expensive production bugs I see in Laravel apps do not throw errors. They simply stop. The scheduler has not run since a server move three weeks ago, so invoices never synced, trial reminders never went out and the nightly report everyone stopped reading is quietly empty. Nothing alerted, because nothing failed. It just never ran.
I run Loop Origin, a software company that builds and maintains custom Laravel applications and the servers under them. I wrote this with help from AI tools and checked every command and config myself. This guide covers one problem: a Laravel scheduler that is not running, and how to catch silent cron and queue failures before your customers or your finance team do.
Why is my Laravel scheduler not running, and how do I catch it?
Direct answer: Laravel's scheduler only runs when a system cron calls php artisan schedule:run every minute. If that cron line, the PHP binary, a stale overlap lock or maintenance mode breaks, tasks stop silently. Catch it with an external heartbeat: each task pings a monitor on success, and the monitor alerts when a ping is late.
The core mistake: monitoring from inside the thing that died
Most teams' first fix is a scheduled job that checks the other scheduled jobs. It feels sensible, and it fails in exactly the case that matters: when the scheduler itself is dead, the checker is dead too. The same goes for "we log every run": a missing log line is not an alert.
The pattern that works is a dead man's switch. Every important task reports "I ran and finished" to something outside the server. That outside system knows each task's expected interval and raises an alert when a report is late. Silence becomes the signal.
The usual causes, from most to least common
These are the failure modes I check first on an inherited codebase:
- The cron line never made it to the new server. The app was moved to a new VPS or a fresh container image, and nobody re-added
* * * * * cd /var/www/app && php artisan schedule:run >> /dev/null 2>&1to the right user's crontab. - Cron runs as a different user or PHP binary. The crontab lives under root, so
storage/logsbecomes root-owned and web requests start failing; orphpon cron's minimal PATH points to an older version than PHP-FPM uses. - A stale overlap lock.
withoutOverlapping()holds a mutex in the cache. If the server crashes mid-run, the lock can survive, and by default it expires after 24 hours, so the task is skipped all day without an error.php artisan schedule:clear-cacheclears it. - Maintenance mode left on. A failed deploy leaves the app down; scheduled tasks do not run in maintenance mode unless marked
evenInMaintenanceMode(). -
onOneServer()without a shared cache. It needs a central cache store (Redis, Memcached, database or DynamoDB). With file cache on two servers, both run the task, and you get duplicates instead of silence. - Timezones and daylight saving. A task scheduled for 2:30 AM in a timezone that observes daylight saving can be skipped or run twice on the changeover days. Schedule critical work in UTC or outside the changeover window.
- Queue workers running old code. The scheduler dispatched the job, but Supervisor workers were never restarted after a deploy (
php artisan queue:restart), so they fail on a renamed class and everything lands infailed_jobs, which nobody reads.
Monitoring options compared
| Approach | Catches "never ran" | Catches "ran and failed" | Catches "stuck or slow" | Setup effort |
|---|---|---|---|---|
| Grepping logs manually | No | Only if someone looks | No | None, and that is the problem |
emailOutputOnFailure() | No | Yes, by email | No | Low |
| Internal "check the checker" job | No (dies with the scheduler) | Yes | Partly | Medium |
| External heartbeat (Healthchecks.io, Cronitor, Better Stack, Sentry Crons) | Yes | Yes, with a fail ping | Yes, with a start ping and a max duration | Low |
Queue depth and wait-time alerts (Horizon waits, queue:monitor) | Not for cron | Indirectly | Yes, for queues | Low to medium |
You need the last two together: heartbeats for the scheduler and its tasks, queue alerts for the jobs those tasks dispatch.
Production setup: heartbeats on every task that matters
In Laravel 11 and later, schedules live in routes/console.php. The scheduler has ping hooks built in, so you do not need a package:
use Illuminate\Support\Facades\Schedule; // 1. Scheduler pulse: proves cron + schedule:run are alive at all Schedule::call(fn () => null) ->name('scheduler-pulse') ->everyMinute() ->pingOnSuccess(config('heartbeats.scheduler')); // 2. A business-critical task with its own heartbeat Schedule::command('invoices:sync') ->everyFiveMinutes() ->withoutOverlapping(15) // lock expires after 15 min, not 24 h ->onOneServer() // requires a shared cache store (e.g. Redis) ->pingBefore(config('heartbeats.invoices_sync') . '/start') ->pingOnSuccess(config('heartbeats.invoices_sync')) ->pingOnFailure(config('heartbeats.invoices_sync') . '/fail'); The /start and /fail suffixes follow Healthchecks.io's ping URL convention; check your monitor's documentation for its own. Store the URLs in config, not in code, so staging does not ping production monitors. Give the overlap lock an expiry slightly longer than the task's worst normal runtime, so a crash costs you 15 minutes rather than a day.
On the monitor side, set each check's period to the schedule interval and a grace time that covers normal variance. A five-minute sync with a ten-minute grace alerts you within about fifteen minutes of the last good run.
Queues: alert on wait time, not just failures
A task that dispatches 500 jobs to a stalled queue looks healthy to the scheduler. Watch the queue itself:
// routes/console.php: emit QueueBusy when the default queue backs up Schedule::command('queue:monitor redis:default --max=500')->everyMinute(); // app/Providers/AppServiceProvider.php use Illuminate\Queue\Events\QueueBusy; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Log; Event::listen(function (QueueBusy $event) { Log::critical('Queue backed up', [ 'connection' => $event->connection, 'queue' => $event->queue, 'size' => $event->size, ]); }); If you use Horizon, set the waits thresholds in config/horizon.php and route its long-wait notifications to Slack or email. Also schedule a daily count of failed_jobs that alerts above zero for critical queues; a growing failed table is a silent outage. My guide on running Laravel queues in production covers Supervisor, retries and the failed jobs workflow in depth.
Deploy steps that prevent the next silent stop
Add these to your deploy script or runbook so the failure modes above cannot come back:
# after code is in place php artisan down --retry=60 php artisan migrate --force php artisan config:cache && php artisan route:cache php artisan queue:restart # workers pick up new code php artisan up # never leave maintenance mode on by accident php artisan schedule:list # confirm tasks and next run times crontab -l -u www-data | grep -q 'schedule:run' || echo 'MISSING SCHEDULER CRON' >&2 Run cron as the same user as PHP-FPM (often www-data), use an absolute PHP path in the crontab if the server has several versions, and keep the crontab in your infrastructure code so a new server gets it automatically. My Linux VPS hardening checklist for Laravel servers covers the user and permission side.
Silent-failure checklist
- A scheduler pulse task pings an external monitor every minute.
- Every business-critical task has its own heartbeat with start, success and fail pings.
- Each heartbeat has a period and a grace time that match the schedule.
-
withoutOverlapping()has an explicit expiry close to the task's worst runtime. -
onOneServer()is used only with a shared cache store. - Critical tasks avoid daylight-saving changeover hours, or run in UTC.
- Queue size or wait-time alerts exist for every queue a scheduled task feeds.
- A daily check alerts when
failed_jobsgrows for critical queues. - Deploys run
queue:restartand finish withphp artisan upandschedule:list. - The crontab is defined in infrastructure code and verified on every new server.
- Alerts go to a channel a named person watches, with a short runbook link.
This is the same thinking behind reliable integrations: my posts on the transactional outbox pattern in Laravel and QuickBooks and Xero invoice sync both depend on a scheduler and workers that you can prove are running. If you would rather hand this off, this is the kind of work we cover in Laravel maintenance and development.
FAQs
How do I check if the Laravel scheduler is running?
Run php artisan schedule:list to see tasks and next run times, check crontab -l for the correct user, and look for a recent ping on your scheduler pulse monitor. A pulse that stopped is the clearest answer.
What does php artisan schedule:clear-cache do?
It deletes the mutex locks created by withoutOverlapping(). Use it when a task stopped running after a crash or a killed process left its lock behind.
Should I use schedule:work in production?
schedule:work is meant for local development. In production, use a system cron entry calling schedule:run every minute, or a dedicated scheduler process managed by your container platform.
Why does my scheduled task run twice?
Usually because two servers run the scheduler without onOneServer() and a shared cache store, or because a daylight-saving change repeated the hour. Fix the cache store first.
Do I need a paid service for cron heartbeats?
Not necessarily. Healthchecks.io is open source and can be self-hosted, and several hosted monitors offer free tiers; check current plans. The key is that the monitor runs outside the server it watches.
Does this apply to Laravel 10 and older?
Yes. The ping methods and withoutOverlapping() work the same way; only the location differs, since older versions define the schedule in app/Console/Kernel.php.
Wrap-up
A scheduler that is not running never throws an exception, so error tracking will never tell you. Make silence loud: an external heartbeat for the scheduler and every critical task, wait-time alerts on the queues behind them, and a deploy script that cannot leave the app down or the workers stale. It is an hour of setup that saves the week you would otherwise spend explaining missing invoices.
What is the longest a scheduled job silently stopped in an app you inherited? Tell me in the comments.
Follow & Connect
- LinkedIn: Loop Origin
- X: Muhammad Ali Mughal (@AliMughal887)
- GitHub: Loop Origin (@LoopOrigin)
Watch on YouTube: Resume Boost AI · PixelValut · Daily AI News By Ali
