Scheduling Scripts to Run Automatically
Linux allows you to schedule a command to run at a specified time. You can use this ability to schedule scripts to run automatically. You schedule jobs using the crontab command.
The first time you schedule a job, you create a file with the commands you want to schedule. Each command goes on a separate line. The crontab format requires six items on the line, each separated by a space. The items are, in the order of occurrence:
Min: Minute to run. Values can be 0–59.
Hour: Hour to run. Values can be 0–23.
Day of month: Day of the month to run. Values can be 1–31.
Month: Month to run. Values can be 1–12.
Day of week: Day of week to run. Values can be 0–6, with 0 being Sunday.
Command: Command to run.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access