DevOps and cloud

Stage 1 · Lesson 8 of 10

Scheduling with cron and systemd timers

Linux, the shell and scripting

runs commands on a schedule. Each line in a crontab (your list of scheduled jobs) has five time fields: minute, hour, day of month, month and day of week. The command comes after them.

So 0 2 * * * /opt/backup.sh runs at 02:00 every day. Edit your own list with crontab -e, and check expressions with a tool such as crontab.guru. systemd timers do the same job with better logging. They can also catch up on runs missed while the machine was off.

Scheduled jobs are where backups, cleanup and reports live. Later they become and scheduled pipelines.

Common trapThe traps are that cron runs with a bare minimum environment, so a command that works in your terminal can fail for lack of a PATH, and that failed jobs are silent unless you send their output somewhere you will actually see it.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Practise

Keep handy

  • The handful of flags people actually use for each command, one line each

Also worth your time

Mark this stage as not done?