How would you get alerted if a critical nightly job silently stops running altogether?
IntermediateScenarioScheduling, automation and scripting
Answer
Situation read → Failure alerts don't fire if the job never starts. You need a heartbeat.
What I'd do →
- At the end of a successful run, ping a dead-man's switch:
/usr/local/bin/backup.sh && curl -fsS -m 10 --retry 3 https://hc.example.com/ping/<uuid>
- Or push a metric
job_last_success_timestampto Prometheus Pushgateway / node_exporter textfile collector, and alert iftime() - job_last_success_timestamp > 90000. - For systemd timers, add
OnFailure=notify@%n.service.
Why → The absence of a signal is what you alert on.
Interview tip → "Alert on missing success, not just on failure" is a senior-level answer.
More on Scheduling, automation and scripting
A database dump must run every night at 1:30 AM. How do you schedule it with cron so it is reliable?BeginnerConvert that nightly cron job to a systemd timer. Why would you?IntermediateA cron job runs every 5 minutes, but sometimes takes 8 minutes and two copies overlap, corrupting data. How do you prevent that?BeginnerYou have 300 servers running the same cron job at midnight, and they hammer a shared API. How do you fix it?IntermediateA job must run on the last day of every month. Cron has no "last day" field. What do you do?IntermediateYou inherited a server and need to know every scheduled job on it. Where do you look?Beginner