Laravel scheduler monitoring: get alerted when a scheduled task fails or stops
Laravel makes scheduling easy, and that makes it easy to forget the scheduler is a single cron line on one server. When it stops, backups, invoices and cleanup jobs stop with it, and nothing tells you. Laravel already has the hooks you need; you only need somewhere to send them.
How Laravel scheduled tasks go quiet
- The
schedule:runcron entry is gone after a server rebuild, a new deploy target or a container that doesn't run cron. - A task fails (exception, timeout, exhausted memory) and the error lands in a log nobody reads.
withoutOverlapping()skips runs because an earlier run hung and its lock is still held.onOneServer()or the cache lock points at a cache store that changed, so every server thinks another one ran it.- Maintenance mode was left on; scheduled tasks don't run in maintenance mode unless you add
evenInMaintenanceMode().
Add a heartbeat with pingOnSuccess and pingOnFailure
Create a free check in CronBeat with the same period as the task. Put the ping key in .env as CRONBEAT_KEY and expose it in config/services.php ('cronbeat' => ['key' => env('CRONBEAT_KEY')]), so it still works with cached config.
Laravel 11 and later, in routes/console.php:
use Illuminate\Support\Facades\Schedule;
$ping = 'https://rtekfsmupinxncwigmnf.supabase.co/functions/v1/api/ping/' . config('services.cronbeat.key');
Schedule::command('backup:run')
->dailyAt('03:00')
->pingOnSuccess($ping)
->pingOnFailure($ping . '/fail');
Laravel 10 and earlier, in app/Console/Kernel.php, the same chain goes inside schedule() on $schedule->command(...). The ping methods send an HTTP GET with Laravel's HTTP client (Guzzle), which ships with standard Laravel apps.
What you get:
- the scheduler or the task never runs → no ping → alert after the grace period;
- the task fails → the
/failping alerts at once; - it recovers → an "UP" message.
Tip: to watch the scheduler itself, add a tiny task such as Schedule::call(fn () => null)->everyFiveMinutes()->pingOnSuccess(...) with its own check. It alerts if schedule:run stops on that server.
Choosing period and grace
Use the task's frequency as the period and a grace time longer than its slowest normal run: for a nightly backup that takes 15 minutes, 1 day with 30–45 minutes of grace. Laravel schedules use your app timezone unless you set ->timezone(); the cron explainer helps with raw expressions.
Where alerts go
Slack or Discord webhooks, or a push notification to your phone through the free ntfy app. Setup steps are in the CronBeat FAQ.
Free: 20 checks, no signup, checked every minute. Public status shows how reliably the checker itself runs.
Create a check · Kubernetes CronJobs · GitHub Actions schedules