Skip to main content

Know when a cron script did not run: one curl line

Add one curl to the end of your crontab line, with the job's schedule in the URL: curl -fsS "http://127.0.0.1:8000/ping/backup?schedule=0+2+*+*+*". Buggregator then knows when the job should run. If nothing comes by then, it marks the run as missed. Ping at the start too, and a run that never finishes shows up as hung.

Steps

1. Start Buggregator with a database file

The default database lives in memory, so jobs and runs are gone after a restart. Keep them in a file:

bash
buggregator -db buggregator.db

In Docker, keep the file in a volume:

bash
docker run --pull always \
  -p 127.0.0.1:8000:8000 \
  -v buggregator-data:/data \
  ghcr.io/buggregator/server:latest -db /data/buggregator.db

2. Add the curl to the crontab line

The first ping creates the job. No setup in Buggregator. A + in the schedule is a space.

bash
0 2 * * * /opt/backup.sh && curl -fsS "http://127.0.0.1:8000/ping/backup?schedule=0+2+*+*+*"

If the script fails, no ping comes, and the run counts as missed.

3. Report start, failure and output

For hung runs, failures and the job's output, wrap the script. A POST body is kept as the run's output, the last 10 KB.

bash
B=http://127.0.0.1:8000
curl -fsS "$B/ping/backup/start?schedule=0+2+*+*+*&tz=Europe/Berlin"
if ./backup.sh > out.log 2>&1; then
  curl -fsS -X POST --data-binary @out.log "$B/ping/backup"
else
  curl -fsS -X POST --data-binary @out.log "$B/ping/backup/fail"
fi

More options go in the query: margin (minutes a run may be late, default 1), max_runtime (minutes a run may take, default 30), tz (default UTC) and project.

4. Open Crons

Open http://127.0.0.1:8000, then Sentry → Crons. Each job shows its status, schedule, last and next run, and a strip of the last 20 runs. Jobs that failed, hung or missed a run come first, under Needs attention. Open a job for its run history and the output each run sent.

Why it works

A ping tells Buggregator «started», «finished» or «failed». With the schedule it knows when the next run is due. Every 30 seconds it checks: a due run with no ping after the margin becomes missed, and a started run that takes longer than max_runtime becomes timeout. Buggregator shows this in the UI; it sends no alerts.

Checked on with Buggregator v2.13.0

Setup in 60 seconds

No registration. No account. Start it and point your app at it.

1

Start Buggregator

One file, installed with one command. The web UI opens on port 8000. Prefer containers? Use the Docker tab.

$ curl -fsSL https://raw.githubusercontent.com/buggregator/server/master/scripts/install.sh | sh
$ HTTP_ADDR=127.0.0.1:8000 \
  SMTP_ADDR=127.0.0.1:1025 \
  VAR_DUMPER_ADDR=127.0.0.1:9912 \
  MONOLOG_ADDR=127.0.0.1:9913 \
  PROXY_ADDR=127.0.0.1:8080 \
  ~/.local/bin/buggregator

The script picks the file for your CPU: Intel/AMD or ARM.

One file for Linux, macOS and Windows, about 40 MB. Nothing else to install.

This run line keeps it on this computer. Without the *_ADDR settings it listens on all network interfaces

Rather not run a script? Download the file yourself

Runs on Windows, macOS and Linux, on Intel/AMD and ARM.

Prefer not to do it yourself? Your AI agent can set Buggregator up for you