You inherited a server and need to know every scheduled job on it. Where do you look?
BeginnerScenarioScheduling, automation and scripting
Answer
Situation read → Jobs hide in many places.
What I'd do →
for u in $(cut -d: -f1 /etc/passwd); do sudo crontab -l -u "$u" 2>/dev/null | sed "s/^/$u: /"; done
ls -l /etc/crontab /etc/cron.d/ /etc/cron.{hourly,daily,weekly,monthly}/
systemctl list-timers --all
atq
ls /var/spool/cron/ /var/spool/cron/crontabs/ 2>/dev/null
Why → User crontabs, system crontabs, run-parts directories, systemd timers and at jobs are all separate.
Interview tip → Mentioning systemd timers and anacron shows you know modern distros.
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?IntermediateA one-off data fix must run at 9 PM tonight, just once. How do you schedule it?Beginner