Monitor PHP Artisan Schedule with CronRabbit
PHPThe Problem
The single cron entry running 'php artisan schedule:run' every minute is a single point of failure. If it stops, all scheduled commands stop.
The Solution
Monitor the artisan schedule:run entry itself with CronRabbit, plus add per-command monitoring for critical tasks.
Two-Layer Monitoring
Layer 1: Monitor the schedule:run cron entry to ensure Laravel's scheduler is alive. Layer 2: Add pingBefore() and thenPing() to individual commands for job-level monitoring.
Code Examples
Monitor the scheduler itself
Bash# Crontab entry
* * * * * cd /var/www && php artisan schedule:run >> /dev/null 2>&1 && curl -fsS -m 10 --retry 5 --retry-all-errors https://ping.cronrabbit.com/scheduler-idPer-command monitoring in Kernel.php
PHP// app/Console/Kernel.php
protected function schedule(Schedule $schedule)
{
$schedule->command('reports:daily')
->dailyAt('06:00')
->pingBefore('https://ping.cronrabbit.com/report-id/start')
->thenPing('https://ping.cronrabbit.com/report-id')
->pingOnFailure('https://ping.cronrabbit.com/report-id/fail');
}