Chapter 15: Scripts and scheduling
Write shell scripts with arguments, tests and loops, and schedule them with cron, systemd timers and at.
What you will learn
- Write and run a bash script, with variables, arguments and exit statuses.
- Use tests, if, case, for and while to make a script decide and repeat.
- Schedule jobs with crontab and /etc/cron.d, and diagnose cron problems from its log.
- Create systemd timers and one-off at jobs, and choose the right scheduler.
Sections
- Your first shell scripts
- Exercise: Write and run your first scripts
- Decisions and loops
- Exercise: Scripts that decide and repeat
- Scheduling jobs with cron
- Exercise: Schedule a job
- systemd timers and one-off jobs
- Exercise: Timers and one-off jobs
- Exercise: Scripts and scheduling review
- Bash scripts and scheduling quiz
- Bash scripts and scheduling cheat sheet