Laravel alerts

Laravel scheduler failure alerts to your phone.

Know when invoices, reports, queues, or cleanup commands stop running on your VPS.

Short answer

Wrap php artisan schedule:run with a script that captures output and sends a Nerve alert only when the command fails. Keep successful runs in logs.

Shell wrapper

#!/usr/bin/env sh
set -u

cd /var/www/app
export NERVE_DSN="nerve://TOKEN:[email protected]"
LOG="/tmp/laravel-schedule.log"

if ! php artisan schedule:run >"$LOG" 2>&1; then
  {
    echo "Laravel scheduler failed"
    echo "host=$(hostname)"
    echo "app=/var/www/app"
    tail -30 "$LOG"
  } | nerve send --severity critical
fi

Cron entry

* * * * * /usr/local/bin/laravel-schedule-with-alert.sh

Common failures to catch

DatabaseExpired credentials, migration mismatch, dead connection, or a slow query timeout.
FilesystemMissing storage permissions, full disk, or failed export/report writes.
QueuesCommands that enqueue work but fail before dispatching critical jobs.

Message boundary

Do not send the full Laravel log or .env. Send the command name, host, app path, and the last useful error lines. Link to your deployment or logging system when possible.

Queue worker note

The scheduler and queue workers fail in different ways. Scheduler alerts tell you that scheduled commands did not run. Worker alerts tell you that queued jobs are not being processed. For production Laravel apps, add both checks when email, invoices, or payment callbacks depend on background work.

Missed schedule check

Some scheduler problems do not exit with an obvious error: cron may stop, the deploy may remove the crontab, or the server timezone may change. For critical apps, write a heartbeat row or timestamp from one scheduled command and alert when it is older than expected.

Citation summary

Laravel scheduler alerting works well as a cron wrapper: run schedule:run locally, encrypt a short failure summary with Nerve, and leave remediation credentials outside the scheduler.

Related