BM: Baca dalam Bahasa Melayu
World L4: Remote Kitchens
Scheduled jobs: cron and timers
You will learn: to run a job on a schedule with cron, and with a systemd timer.
Checked with Linux (Debian 13) on 1 Nov 2026
The problem
Someone must back up the menu at 2 a.m., every night. Nobody wants that shift. This one line does it. How?
Try it
cron: The shop's roster on the wall. It checks every minute and runs jobs on time. is the roster on the wall. It checks every minute. A roster line has five time fields, then the job. Put the fields in order.
First field at the top. Put these in order. Use the arrows, or drag.
- minute (0-59)
- hour (0-23)
- month (1-12)
- day of the month (1-31)
- the command, with its full path
- day of the week (0-7, Sunday is 0 or 7)
Try it
jobs.txt holds a roster line for every minute. Install it with crontab jobs.txt. Then sleep 15 until a minute passes, and read cron.log.
You are you in /home/you. 2 things here. Services: cron running, ssh running, nginx running.
you@kedai:~$Folder ~
- hello.sh (file)
-rwxr-xr-xcan run - jobs.txt (file)
-rw-r--r--
+ 3 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Hint
The clock here starts at 09:00:40. One minute comes quickly.Predict
What does */15 * * * * mean?
Pick one answer.
Watch
systemd has its own alarm clock: a systemd timer: systemd's own alarm clock. It starts a service on a schedule and logs to the journal.. It starts a service on time. Persistent=true catches up on a run missed while the machine was off.
Check
cron or a systemd timer?
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now schedule a job with cron or a systemd timer.
Go deeper (optional)
cron runs with a tiny PATH and no terminal. Use full paths, and save output: >> /home/you/backup.log 2>&1. crontab -r deletes your whole roster without asking. systemd-analyze calendar '*-*-* 02:00:00' tells you when a timer fires next. Timer outputs here came from a real Debian 13 lab.
Real mission
echo '* * * * * date >> /tmp/tick.log' | crontab -cat /tmp/tick.logcrontab -rsystemctl list-timers
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
Seseorang mesti buat sandaran menu pukul 2 pagi, setiap malam. Tiada siapa mahu syif itu. Satu baris ini melakukannya. Bagaimana?
cron ialah jadual tugas di dinding. Ia semak setiap minit. Satu baris jadual ada lima medan masa, kemudian kerjanya. Susun medan itu.
jobs.txt ada satu baris jadual untuk setiap minit. Pasang dengan crontab jobs.txt. Kemudian sleep 15 sampai seminit berlalu, dan baca cron.log.
Apa maksud */15 * * * *?
systemd ada jam locengnya sendiri: timer. Ia mulakan servis tepat pada masanya. Persistent=true kejar larian yang terlepas semasa mesin dimatikan.
cron atau timer systemd?
Kini anda boleh jadualkan kerja dengan cron atau timer systemd.
You finished this before. Practice is always welcome!
Official docs: Debian: crontab(5) · systemd.timer · systemd.time: calendar events
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?