A scheduled job must only run if the previous job in a chain succeeded. How do you build job dependencies on a single host?
AdvancedScenarioScheduling, automation and scripting
Answer
Situation read → Chain with systemd dependencies instead of guessing times.
What I'd do →
extract.service(oneshot) with a timer.transform.servicewith:
[Unit]
Requires=extract.service
After=extract.service
- Or in
extract.service:ExecStartPost=/usr/bin/systemctl start --no-block transform.service(only runs on success), plusOnFailure=alert@%n.service.
Why → Time-based chains ("extract at 1:00, transform at 2:00") break the first time extract runs long.
Interview tip → Above a few steps, say you'd move it to Airflow or a CI pipeline for visibility.
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