How to Monitor Cron Jobs in Ruby on Rails
Rails apps schedule work in several ways, and each can fail quietly: a whenever-generated crontab that a deploy forgot to update, a sidekiq-cron schedule that stopped because Sidekiq is down, or a rake task that errors before it logs anything useful.
A rake task on cron
0 3 * * * cd /app && bin/rails backup:run && curl -fsS https://api.cronguard.dev/v1/ping/<your-uuid>Pinging from Ruby
For start/success/failure signalling inside a job or task:
require "net/http"
BASE = "https://api.cronguard.dev/v1/ping/<your-uuid>".freeze
def ping(suffix = "")
Net::HTTP.get(URI(BASE + suffix))
rescue StandardError
nil # never let monitoring break the job
end
ping("/start")
begin
BackupService.call
ping
rescue StandardError
ping("/fail")
raise
endsidekiq-cron
Put the ping at the end of the worker’s perform method so it only fires on a clean run, and add a separate monitor that pings every minute to confirm Sidekiq itself is alive.
Get alerted
Point those pings at CronGuard, set the schedule, and you’ll get instant multi-channel alerts whenever a Rails job fails to check in — no agent required. Free to start.
Stop losing sleep over silent failures
CronGuard alerts you within minutes when a scheduled job fails to check in. No agent to install. Free to start.
Start Monitoring Free