How to Monitor Cron Jobs in Go (robfig/cron & more)
Go services often schedule background work in-process with robfig/cron or a time.Ticker. That is convenient, but it means the schedule lives and dies with the process — a crash or a deploy that never restarts cleanly takes every job down quietly. An external heartbeat catches it.
robfig/cron
Wrap the job body and ping on start, success and failure:
package main
import (
"net/http"
"time"
"github.com/robfig/cron/v3"
)
const base = "https://api.cronguard.dev/v1/ping/<your-uuid>"
func ping(suffix string) {
c := http.Client{Timeout: 10 * time.Second}
resp, err := c.Get(base + suffix)
if err == nil {
resp.Body.Close()
}
}
func main() {
c := cron.New()
c.AddFunc("0 3 * * *", func() {
ping("/start")
if err := runBackup(); err != nil {
ping("/fail")
return
}
ping("")
})
c.Start()
select {}
}Plain cron calling a Go binary
0 3 * * * /usr/local/bin/backup && curl -fsS https://api.cronguard.dev/v1/ping/<your-uuid>Alerting
Send the pings to CronGuard, define the expected interval, and get instant SMS, WhatsApp, Slack, Telegram or email alerts when a Go job misses its window — with execution-time tracking. Free to start, nothing to install.
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