Skip to content

Monitor Render and Heroku cron jobs

Platform cron jobs run a command on a schedule and keep the logs for a while. Nobody reads those logs until something breaks. A heartbeat check tells you sooner: the command reports to Pingstack after it succeeds, and Pingstack alerts you when that report doesn’t arrive on time.

1. Create a heartbeat check that matches the schedule

Section titled “1. Create a heartbeat check that matches the schedule”

Both platforms run schedules in UTC, so choose UTC in Pingstack. See schedules and timezones.

  • Render: a cron job has a standard cron schedule, such as 0 2 * * *. Use the same expression.
  • Heroku Scheduler: jobs run every 10 minutes, every hour, or daily at a time you pick. Use an Interval of 10 minutes, cron M * * * * for the hourly minute it shows, or cron for the daily time (for example 30 2 * * *).

Create a heartbeat check with that schedule and a grace period longer than the job’s runtime. Heroku describes its Scheduler as best-effort and can occasionally skip or delay a run; a generous grace period avoids alerts for small delays, and a skipped run is worth knowing about. Attach a notification group.

2. Store the ping URL as an environment variable

Section titled “2. Store the ping URL as an environment variable”

Copy the location’s ping URL from the check in Pingstack.

  • Render: add PINGSTACK_PING_URL under the cron job’s Environment.
  • Heroku: add it as a config var. To keep it out of your shell history, use the app’s Settings › Config Vars in the dashboard.

Chain the report onto the job’s command:

Terminal window
./bin/nightly-report && curl --fail --silent --show-error --max-time 10 --retry 3 "$PINGSTACK_PING_URL"
  • Render: use this as the cron job’s Command.
  • Heroku Scheduler: use it as the job’s Run Command.

&& runs the report only if the job exits successfully, so a failed run sends nothing and Pingstack alerts you when the deadline passes. If you’d rather report from inside your program, call the ping URL at the end, after the work succeeds.

  • Render: open the cron job and choose Trigger Run.
  • Heroku: run the same command once with heroku run.

Open the check in Pingstack and confirm the location received a heartbeat and shows a next deadline.

Add --get --data-urlencode "value=$COUNT" to the curl call with a count the job produces to send it as a numeric value. Then set warning and critical thresholds on the check.

  • Heroku best-effort scheduling. Occasionally a run is late or skipped. If that’s frequent and matters, move the job to a dedicated scheduler.
  • Long runs. A job that runs longer than its interval can be stopped or skipped by the platform. Either way, it stops reporting on time.
  • Build failures. A failed deploy can leave a Render cron job on an old build, or without one. Check the latest deploy.

If alerts still don’t match what you expect, see troubleshooting monitoring.