Bash Automation: A Script You Can Trust — Challenge
20 minBeginner
You are done when
0 of 4
The goal#
Achieve the same outcome as Bash Automation: A Script You Can Trust, from an empty starting point, without the steps.
There is a backup script on the server. It has 'run successfully' every night for eight months. The backup directory is empty.
It has been exiting 0 the whole time, because nothing in it ever checked whether anything worked.
What must be true when you are done#
- The script exits non-zero when any step fails, proven by deliberately breaking one.
- Running it twice does not corrupt or duplicate the previous backup.
- A backup older than the retention window is removed automatically.
- A failed run is visible without anyone reading the logs.
Rules#
- Do not open the guided lab until you are finished, or until you have been stuck on the same thing for 20 minutes. Being stuck is the exercise; staying stuck is not.
- Official documentation is allowed and encouraged. In the job it is the first thing you open.
- Verify every criterion yourself with a command whose output you can read. "It looks right" is not a check.
If you get stuck#
Work in layers rather than restarting things:
- What did you expect to happen, exactly?
- What happened instead — the error text, not a paraphrase?
- Which layer is that error from?
- What is the smallest command that proves the layer below is fine?
That sequence is the skill this tier exists to build. The commands are lookup-able; the sequence is not.