Module 11 of 12

Automation & Scheduling

Lessons

About This Module

Scripts are most useful when they run without you. A backup that only happens when you remember is not much of a backup. The shell gives you several ways to run a command later, or again and again on a schedule, so routine jobs take care of themselves.

This module starts with the at command for one-time jobs, including managing the queue with atq and atrm. Next comes cron and crontab, the classic way to run jobs on a repeating schedule, including how to read the five time fields. Then systemd timers, a modern alternative that adds journal logging and catch-up runs for missed jobs. The module finishes with a backup script in Bash, a realistic job to schedule with the tools you have just learned.

Practise on a Linux machine or a virtual machine as you watch the lessons in order, then continue on to Debugging & Robust Scripts.

Lessons

4 videos
01

Scheduling One-Time Jobs with the at Command

How to install the at command, schedule a script to run once at a set time, and manage pending jobs with atq and atrm.

02

Cron Jobs for Beginners

Jay LaCroix explains how cron works, how to edit your crontab, and how to read the five time fields, with practical examples including hourly jobs.

03

Automate Your Tasks with systemd Timers

How systemd timers differ from cron, and how to build a service and timer pair with OnCalendar schedules and Persistent=true so missed runs still happen.

04

Writing a Backup Script in Bash

A walkthrough of a sample backup script, first tested with --dry-run and then run for real. A good candidate to schedule with cron or a timer.