16. Scheduling and Job Automation#
This chapter shows how scripts become scheduled and repeatable automation through cron, long-running workers, and bounded parallel execution. Backup scope, retention, and recovery are developed in Chapter 18.
Scheduling: Run scripts at predictable times with
cronandat.Unattended checks: Run a verified status script with a predictable environment and overlap protection.
Long-running tasks: Design scripts that continue safely beyond one terminal session.
Parallelism: Use controlled concurrency for large batches of work.
Reliability: Make unattended jobs observable and recoverable.
Chapter Video
How To Write Bash Scripts In Linux: CRON Jobs (15:06) by Learn Linux TV
Hosted on YouTube; property of its original creator, embedded here for educational reference only.
Learning Objectives
By the end of this chapter, you will be able to:
Schedule recurring and one-time jobs with
cronandat.Design long-running scripts with appropriate process behavior.
Use
xargsfor controlled parallel processing.
Chapter Flow
Glossary
# |
Term |
Explanation |
|---|---|---|
1 |
Cron |
A scheduler for recurring commands and scripts. |
2 |
Crontab |
A table of cron entries for a user or system. |
3 |
Cron expression |
The minute, hour, day, month, and weekday fields that schedule a cron job. |
4 |
|
A command for scheduling a one-time job. |
5 |
Scheduled job |
A command or script configured to run at a specified time. |
6 |
Environment |
The variables and context available to a scheduled command. |
7 |
Absolute path |
A complete path used to avoid cron’s limited command lookup context. |
8 |
Maintenance script |
Automation for routine tasks such as cleanup, updates, or checks. |
9 |
Daemon |
A long-running background process that provides a service. |
10 |
|
A command that lets a process keep running after a terminal closes. |
11 |
PID file |
A file storing a process identifier for later management. |
12 |
Lock file |
A file used to prevent multiple instances from running at once. |
13 |
Health check |
A test that confirms a process or service is working. |
14 |
Parallel processing |
Running multiple tasks at the same time. |
15 |
|
A command that builds command lines from input items. |
16 |
Concurrency limit |
A cap on how many jobs run at once. |
17 |
Failure recovery |
The logic used to retry, alert, or stop safely after an error. |