Linux

Job Scheduling (cron & timers)

21 flashcards · answers and spaced-repetition review in the KnowCard app

Your machine unexpectedly starts hitting the disk and sending mail every 60 seconds. What about the cron daemon's design explains this once-a-minute rhythm?
In what order do the seven fields of a line in /etc/crontab appear, and what do an asterisk and the notation slash-n each do to a time field?
Which weekday number schedules a cron job for Sunday, and what surprising thing do the values 0 and 7 have in common?
You add a job as the last line of /etc/crontab but it never runs, even though the syntax looks perfect. What formatting rule is the usual culprit?
You drop a script into /etc/cron.daily but nothing happens on the next run. What one-line permission fix is almost always missing, and what privileges do these scripts run with?
When you edit your personal cron jobs with crontab -e instead of touching /etc/crontab, how does the field layout of your entries differ?
On Debian or Ubuntu, you name a cron.daily script backup.sh and it silently never runs. What naming rule did you break, and why does it exist?
A laptop is powered off overnight, right through the time its daily cron maintenance was due. What tool ensures that job still runs, and how does it avoid running it twice?
Besides /etc/crontab and the cron.daily-style folders, packages often drop jobs into /etc/cron.d. What line format do files there use?
The /etc/cron.hourly|daily|weekly|monthly directories exist everywhere, but the machinery running them differs by distro. How do Ubuntu, SUSE, and 'most others' handle them?
You open /etc/anacrontab to add a periodic task. What do its columns mean, and what does RANDOM_DELAY buy you?
On Fedora, cron isn't installed at all — systemd runs periodic jobs instead. What file type drives this, and how do you list what's scheduled?
In a .timer [Timer] section, what's the difference between OnBootSec, OnActiveSec, OnUnitActiveSec and OnUnitInactiveSec — and what unit applies to a bare number like 30?
You want a systemd timer to fire at an absolute wall-clock time and still catch up if the box was off. Which [Timer] keys do that, and how do you tighten the firing window?
You wrote a foo.timer but nothing runs. What companion file must exist, and what Type does its [Service] section typically use for a run-and-exit command?
Setting up a systemd timer is far more work than one crontab line. What do you gain for that effort, and what does cron still do that timers don't?
A backup script runs fine by hand but fails from cron with 'command not found' for a tool in /usr/local/bin. Why, and what are two fixes?
Two files decide who besides root may run cron jobs. Where do they live, and what happens if neither exists?
Instead of typing five time columns, cron accepts @-shortcuts. What crontab lines do @daily, @weekly, @monthly and @reboot expand to?
A cron line begins with a minus sign before the minute field. What does that do, and why is it rejected unless the job runs as root?
A cron job prints a warning to stdout. Where does that text go by default, and how do you redirect it elsewhere?

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play