Linux cron with Cronwatch
The check is set for a job that runs every hour, the most common crontab schedule. Copy the crontab line, append the ping, and you will know within the hour if the job stops running.
- Create the check with an hourly schedule and 15 minutes of grace.
- Copy the crontab snippet and replace /path/to/backup.sh with your command.
- Edit your crontab with crontab -e and paste the line; keep && so the ping only fires when the command succeeds.
- Run the command once by hand, or press Send test ping, and watch the check turn UP.
What to know
grep CRON /var/log/syslog tells you a job started, not that it finished or did anything useful. Logs rotate, servers get replaced and nobody reads them until something is already broken. A ping at the end of the command is direct evidence that the work completed.
Chaining with && is the important detail: the ping only runs when the command exits with status 0. If you want to know about failures straight away rather than after the grace period, use the bash snippet, which calls /fail on a non-zero exit. For commands that print a lot, redirect output to a log file so cron does not try to mail it.
Pick the grace period from how long the job usually takes plus a margin. If the job runs at minute 0 and takes up to ten minutes, a 15-minute grace avoids false alarms while still alerting you well within the hour.
Updated · Cosmovex
Questions
How do I check if a cron job ran?
Add a ping to the end of the command. If Cronwatch received the ping, the job finished successfully; if not, you get an email after the schedule plus grace time.
Will the ping slow down or break my job?
No. curl -fsS -m 10 --retry 3 gives up after a few seconds and runs after your command, so the job itself is never affected.
Does it work with systemd timers?
Yes. Add the curl line to the end of the service ExecStart script, or use ExecStartPost, and choose a schedule that matches the timer.
Can I see run times?
Yes. Call the /start URL before the job and the success URL after it; Cronwatch shows the duration of each run.
The free plan covers everything on this page. Cronwatch Pro ($5/mo, billed monthly) is described on the Cronwatch page.