Email alerts with Cronwatch
This check is set up for the classic case: a daily job that should email you when something goes wrong. Cronwatch emails you when the job does not report in on time, and again when it recovers, so silence never hides a failure.
- Create the check: it expects a ping every day with one hour of grace.
- Confirm your email address under Alerts. Cronwatch only emails confirmed addresses.
- Wrap your job with the bash snippet: it pings /start, then the success URL, or /fail if the job exits with an error.
- Press Send test ping to see the check turn UP, then wait for your real job to run.
What to know
MAILTO in crontab only emails you when a job prints output, and only if the server can actually send mail. Most cloud servers cannot, so a failing job goes completely silent. Worse, a job that never starts, because the server rebooted, the crontab was overwritten or the disk filled, produces no output at all, so MAILTO cannot catch it.
A heartbeat check works the other way round. Your job reports in when it finishes, and Cronwatch emails you when the report does not arrive within the schedule plus the grace time. That catches crashed jobs, jobs that hang, jobs that never start and servers that are down, with one email when it goes down and one when it is back.
Use the /fail URL from your error path so a failure alerts you immediately instead of after the grace period, and the /start URL to measure how long the job runs. Keep curl options -fsS -m 10 --retry 3 so the ping never blocks or breaks the job itself.
Updated · Cosmovex
Questions
Why not just use MAILTO in crontab?
MAILTO only sends output, needs a working mail setup on the server and says nothing when a job never runs. A heartbeat check alerts on silence, which is the failure you actually miss.
How many emails will I get?
One when a check goes down and one when it comes back up. Cronwatch does not repeat the alert every minute.
Can I alert on failure immediately?
Yes. Request the /fail URL when the job exits with an error and the check goes down at once, with an email.
Is the email alert free?
Yes. Email alerts are free for up to 3 checks. Pro adds Slack, Discord and webhook alerts and 50 checks.
The free plan covers everything on this page. Cronwatch Pro ($5/mo, billed monthly) is described on the Cronwatch page.