BM: Baca dalam Bahasa Melayu
World L4: Remote Kitchens · Boss challenge
Fix the nightly backup
You will learn: to turn a backup that fails quietly into one that is loud, correct and on the roster.
Checked with Linux (Debian 13) on 1 Nov 2026
The problem
You are you in /home/you. 3 things here. Services: cron running, ssh running, nginx running.
you@kedai:~$Folder ~
- backup.sh (file)
-rwxr-xr-xcan run - backups/ (folder)
drwxrwxr-x - kedai/ (folder)
drwxrwxr-xmenu
+ 3 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Boss! The backup said backup done every night. Today the menu broke, and you need yesterday’s copy. The backups folder is empty!
Check
It printed an error, then backup done, and exit code 0. Why did it look fine?
Pick one answer.
Try it
Stage 1: make it loud. Turn on strict mode (line 3), then run it. It should fail, out loud.
You are you in /home/you. 3 things here. Services: cron running, ssh running, nginx running.
you@kedai:~$Folder ~
- backup.sh (file)
-rwxr-xr-xcan run - backups/ (folder)
drwxrwxr-x - kedai/ (folder)
drwxrwxr-xmenu
+ 3 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Watch
The real error says cp: cannot create directory '/home/you/backup/menu-2026-11-01': No such file or directory. Tap the line with the wrong folder.
Tap the line with the wrong folder.
0 of 1 found
Try it
Stage 2: fix the folder name, then run it. A dated copy should land in backups.
You are you in /home/you. 3 things here. Services: cron running, ssh running, nginx running.
you@kedai:~$Folder ~
- backup.sh (file)
-rwxr-xr-xcan run - backups/ (folder)
drwxrwxr-x - kedai/ (folder)
drwxrwxr-xmenu
+ 3 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Predict
Stage 3 needs a roster line for 2 a.m., every night. Which one?
Pick one answer.
Try it
Stage 3: put it on the roster for 2 a.m. Bonus: keep its words in a log with >> /home/you/backup.log 2>&1.
You are you in /home/you. 3 things here. Services: cron running, ssh running, nginx running.
you@kedai:~$Folder ~
- backup.sh (file)
-rwxr-xr-xcan run - backups/ (folder)
drwxrwxr-x - kedai/ (folder)
drwxrwxr-xmenu
+ 3 hidden (ls -a)
Services
cronrunningstarts at bootsshrunningstarts at bootnginxrunningstarts at boot
Check
Lessons from the night. Good rule or not?
Swipe right for good, left for needs work. Or use the buttons.
A loud failure beats a quiet one.
You did it!
You can now make a backup script loud, correct and scheduled.
Go deeper (optional)
A systemd timer is the other way to schedule it (lesson 5). Its failures show in systemctl status and journalctl. Many teams also send an alert when a backup fails. The Monitoring & Observability course shows how.
Real mission
./backup.sh; echo $?
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
Boss! Sandaran itu kata backup done setiap malam. Hari ini menu rosak, dan anda perlukan salinan semalam. Folder backups kosong!
Ia cetak ralat, kemudian backup done, dan kod keluar 0. Kenapa ia nampak okey?
Peringkat 1: jadikan ia jelas. Hidupkan mod ketat (baris 3), kemudian jalankan. Ia patut gagal, dengan jelas.
Ralat sebenar kata cp: cannot create directory '/home/you/backup/menu-2026-11-01': No such file or directory. Tekan baris dengan folder yang salah.
Peringkat 2: baiki nama folder, kemudian jalankan. Satu salinan bertarikh patut mendarat dalam backups.
Peringkat 3 perlukan baris jadual untuk pukul 2 pagi, setiap malam. Yang mana?
Peringkat 3: masukkan dalam jadual untuk pukul 2 pagi. Bonus: simpan kata-katanya dalam log dengan >> /home/you/backup.log 2>&1.
Pengajaran malam ini. Peraturan yang baik atau tidak?
Kini anda boleh jadikan skrip sandaran jelas, betul dan berjadual.
You finished this before. Practice is always welcome!
Official docs: Bash manual: the set builtin · Debian: crontab(5) · systemd.timer
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?