Scheduled jobs: cron, at, systemd timer
Sign in to read this lesson
A nightly backup, a weekly report, a one-off "reboot the server at 23:00" — these are scheduled jobs. RHEL has three tools — cron (recurring), at (one-off) and the systemd timer. In this lesson we learn the crontab syntax, /etc/cron.d, the at queue, and moving from cron to a timer.
What you will learn
- A crontab line:
minute hour day month weekday command—0 2every night at 02:00,/15every 15 minutes,30 8 1-5weekdays at 08:30. - A user crontab:
crontab -e,crontab -l, and root for someone else:crontab -u name -e. - System jobs: files in
/etc/cron.d/also have a user column:0 2 * root command. - A one-off job:
echo "command" | at 23:00,atqthe queue,atrm Ndelete (packageat, serviceatd). - A
systemd timerkeeps its logs injournalctland withPersistent=trueruns a missed job.
The lesson has 5 key points, an explanation and 5 questions. It opens with a package.