All guides
Cron jobs·2 min read

RECIPE: LINUX CRONTAB

Monitor a job scheduled with cron on a Linux server.

1

Create the endpoint

Create a cron job endpoint and copy its push URL.

2

Edit the crontab

Run crontab -e and add the call after your job:

# Every night at 02:00
0 2 * * * /opt/backup.sh && curl -fsS -X POST "https://upguru.io/api/push/YOUR-TOKEN" -d "done" || curl -fsS -X POST "https://upguru.io/api/push/YOUR-TOKEN?level=error" -d "backup failed"

&& runs the first curl when the job succeeded, || the second one when it failed.

3

Test it

Run the same line in your terminal once. The call shows up on the endpoint's timeline right away.

Cron runs with a very short PATH. Use full paths (/opt/backup.sh, /usr/bin/curl) if your job works in the terminal but not from cron.