Laravel · Scheduled Commands

Monitor Laravel Scheduled Commands

Laravel's scheduler has built-in hooks for exactly this — `pingOnSuccess()`, `pingBefore()`, and `pingOnFailure()` — so wiring up monitoring is a one-line addition to an existing schedule entry, no extra package required.

Setup

1

Create an incoming monitor

In Pingtastic, add a new incoming (heartbeat) monitor for the command — name it something like "nightly-report" and set the grace period a little past your schedule interval. Copy its ping URL.

2

Add pingOnSuccess() to the schedule entry

Laravel's scheduler natively supports ping hooks on any scheduled command — no package install needed. Add it to the existing entry in routes/console.php (Laravel 11+) or App\Console\Kernel (Laravel 10 and earlier).

routes/console.php
Schedule::command('reports:nightly')
    ->dailyAt('02:00')
    ->pingOnSuccess('https://ping.pingtastic.net/ping/nightly-report');
3

Optionally alert on failure too

Add a second monitor and chain ->pingOnFailure() if you want a separate immediate alert when the command exits non-zero, rather than waiting for the heartbeat grace period to lapse.

Gotchas

  • ⚠pingOnSuccess() only fires if Laravel's own cron entry (`* * * * * php artisan schedule:run`) is actually running — if the server's system cron itself is broken, nothing pings, which is exactly the failure case Pingtastic's grace period is designed to catch.
  • ⚠Set the grace period meaningfully longer than the schedule interval (e.g. 90 minutes for a daily job) — scheduler runs can shift by a few minutes depending on server load, and a too-tight grace period causes false alerts.

Questions

Do I need a package to ping from Laravel’s scheduler?

No — pingOnSuccess(), pingBefore(), and pingOnFailure() have been built into Laravel's scheduler since Laravel 9. Just pass your Pingtastic monitor URL.

What if my scheduled command itself never ran because cron is down?

That's exactly what this catches — if `php artisan schedule:run` never fires (server cron broken, deploy broke the crontab, etc.), no ping ever arrives, and Pingtastic alerts once the grace period lapses.

Start monitoring your Laravel scheduled commands

Set up your first monitor in under five minutes.

Get started — $5/month