Mastering Linux Command Line 11/19/2019
Mastering Linux Command-line
Scheduling Jobs
GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com
Scheduling Jobs
at at: One-time execution at a later time.
batch batch: One-time execution at a later time,
when the system is under less load.
cron
cron: one-time or recurring
GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com
cron & crontab
cron daemon that handles cron jobs
root 1386 1 0 09:04 ? 00:00:01 /usr/sbin/crond -n
crontab file that contains the instructions to execute a task periodically
Minute Hour Day of the month Month Day of the week Command to execute
GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com
www.GlobaleTraining.com 1
Mastering Linux Command Line 11/19/2019
0 = Sunday
Crontab layout 1 = Monday
.
.
7 = Sunday
Command
0-59 1-31 0-7 To Run
Minute Hour Day of the month Month Day of the week Command to execute
0-23 1-12
Purpose Example Meaning
* Any Value Minute: * Every minute
, Value separator Minute: 5,10 5th and 10th Minute
- Range Month: 1-6 First 6 months (Jan thru June)
/ Step values Minute: */5 Every 5th minute
Hour: */4 Every 4th hour
GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com
Crontab layout
Minute Hour Day of the month Month Day of the week Command to execute
0 5 * * * ./backup.sh
*/5 */3 15 3,6,9,12 * ./backup.sh
GlobalETraining.com
Mastering Linux Command Line GlobaleTraining.com
www.GlobaleTraining.com 2