Your team wants every server to automatically install security updates. How do you set it up and stay safe?
IntermediateScenarioScheduling, automation and scripting
Answer
Situation read → Automate patching without surprise outages.
What I'd do →
- Ubuntu/Debian:
apt install unattended-upgradesand enable security origins in/etc/apt/apt.conf.d/50unattended-upgrades. - RHEL/Rocky:
dnf install dnf-automatic, setupgrade_type = securityandapply_updates = yesin/etc/dnf/automatic.conf, thensystemctl enable --now dnf-automatic.timer. - Roll out in rings: canary hosts first, then the fleet a day later. Control reboots separately.
Why → Security-only updates have low regression risk; rings catch the rest.
Interview tip → Mention needs-restarting -r (RHEL) or /var/run/reboot-required (Ubuntu) for reboot detection.
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