Vivere

Cron jobs (Linux, macOS)

Add a ping to a crontab line with curl, or wrap the job.

The one-line way

Append a ping to the crontab line. It only runs when the job exits 0, because of &&:

0 2 * * * /opt/backup.sh && curl -fsS -m 10 --retry 3 -o /dev/null https://vivere.dev/p/<monitor-id>

If the job fails, no ping is sent and the monitor goes Down once its grace runs out. To hear about failures immediately, report the exit code instead:

0 2 * * * /opt/backup.sh; curl -fsS -m 10 --retry 3 -o /dev/null https://vivere.dev/p/<monitor-id>/$?

The complete way

0 2 * * * vivere run --url https://vivere.dev/p/<monitor-id> -- /opt/backup.sh

Start time, duration, exit code and the last 16 KB of output are all recorded. See the CLI.

Matching the schedule

Use a cron expression on the monitor (0 2 * * * with your server's timezone) so Vivere expects a ping after each scheduled time rather than every fixed period. Set grace to a little more than the job's normal duration.

Cron's PATH is minimal. Use full paths (/usr/bin/curl, /usr/local/bin/vivere) if a job that works in your shell fails under cron.