See whether a cron job worked

cron, run history, exit code, output, failure email, schedules · 0 found this helpful

Schedules keeps a record of every run: when it started, how long it took, its exit code and what it printed. This article shows where to find a job's results and what to do when it fails.

Jobs still in cron

A job that hasn't been moved to Schedules has no run history. Move it to start recording its runs. It keeps its timing, and no run is missed or doubled. See Move cron jobs to Schedules.

Read a job's results

  1. Open Account → Hosting → your site → Schedules.
  2. Find the task. Its row shows a dot for each recent run.
  3. Click History on the task to see its runs, newest first. Open a run to see its output.
A task's run history with one failed run open

A run with exit code 0 worked. Anything else means the command reported an error. The exit code table in See past runs and their output explains the common ones.

Get an email when a job fails

  1. Click Edit on the task.
  2. Under Email me after, choose how many failed runs in a row should send an email.
  3. Click Save schedule.

We email the address on your Barbrick account. See Get emailed when a scheduled task fails.

If something goes wrong

Problem Fix
No runs show The task hasn't run yet. Wait for its next run, or click Run now
A run shows exit 0 but the job didn't do its work Your script ended without reporting the error. Make it exit with a non-zero code when it fails, like exit(1); in PHP
The output is cut off Long output is trimmed. Write long logs to a file instead

Was this helpful?

Still stuck? Ask us and we'll walk you through it.