Schedule automated tasks in Linux with cron jobs

Published: 09 September 2022
on channel: Linux Nomad
140
4

In this video we demonstrate the concept of cron jobs to schedule automated commands at specific periods of time.

The cron syntax:
m h dom mon dow command
or
m h dom mon dow /path/to/script

is the foundation of cron jobs where the user defines the time intervals
using the fields:

m=minute with value in range (0-59),
h=hour with value in range (0-23) where 0 is midnight,
dom=day of month with value in range (1-31),
mon=month with value in range (1-12),
dow=day of week with value in range (0-6) where 0 is Sunday.

Cron uses 4 operator symbols which allow you to specify multiple values in a field and therefore define all kinds of time intervals:
Asterisk (*): specifies all possible values
The comma (,): specifies a list of values
Dash (-): specifies a range of values
Separator (/): specifies a step value.

Using the above syntax we define one cron job that creates a textfile every two minutes and another one that popups a terminal window and initiates a system update check. We explain the cron syntax and give some ideas of how to use the operator symbols to define various kinds of time intervals.
Of course the demonstrated examples are too simple but offer the foundation of executing your own scripts in an automated scheduled way since the only thing you need to master is the cron syntax (which is not hard tbh).

References:
https://en.wikipedia.org/wiki/Cron
https://vitux.com/scheduling-a-task-o...
https://www.tecmint.com/create-and-ma...
https://fedoramagazine.org/scheduling...


Watch video Schedule automated tasks in Linux with cron jobs online without registration, duration hours minute second in high quality. This video was added by user Linux Nomad 09 September 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 140 once and liked it 4 people.