Add lesson 8: Cron and scheduling
3 changed files with 29 additions and 0 deletions
lessons/08-cron-and-scheduling/README.md ADDED
| @@ -0,0 +1,19 @@ | ||
| 1 | +# Lesson 8: Cron and scheduling | |
| 2 | + | |
| 3 | +This lesson covers cron and scheduling. You'll read a short explanation, try three small exercises and finish with a quiz. | |
| 4 | + | |
| 5 | +Full lesson: [https://glibcode.net/courses/linux-shell/lessons/8](https://glibcode.net/courses/linux-shell/lessons/8) | |
| 6 | + | |
| 7 | +## Files | |
| 8 | + | |
| 9 | +- `crontab.txt`: running the backup every night with cron | |
| 10 | + | |
| 11 | +## Run it | |
| 12 | + | |
| 13 | +```sh | |
| 14 | +# type the commands from crontab.txt one by one; don't run it as a script | |
| 15 | +``` | |
| 16 | + | |
| 17 | +## Exercises | |
| 18 | + | |
| 19 | +See [exercises.md](exercises.md). Ask in the forum once you've tried. | |
lessons/08-cron-and-scheduling/crontab.txt ADDED
| @@ -0,0 +1,5 @@ | ||
| 1 | +# m h dom mon dow command | |
| 2 | + 30 2 * * * $HOME/bin/backup.sh >> $HOME/backups/backup.log 2>&1 | |
| 3 | +# every Monday at 08:00 | |
| 4 | + 0 8 * * 1 $HOME/bin/weekly-report.sh | |
| 5 | +# install with: crontab crontab.txt check with: crontab -l | |
lessons/08-cron-and-scheduling/exercises.md ADDED
| @@ -0,0 +1,5 @@ | ||
| 1 | +# Exercises: lesson 8 | |
| 2 | + | |
| 3 | +1. Run `crontab.txt` and change one value. Write down what you expect, then run it again and compare. | |
| 4 | +2. Look up one function or command the example uses in the official documentation. Note one option you didn't know. | |
| 5 | +3. Rewrite the main part so it runs twice with two different inputs, without copying the code. | |