Automating recurring tasks with Cron

Setup a crontab file which defines whe the task should run:

m h d M D /script


m minute: 0-59
h hour: 0-23
d day of the month: 1-31
M month of the year: 1-12
D day of the week, Sunday-0, 0-6
/script the script to execute

Values that are not relevant can be replaced with a ‘*” character.


Run scriptA at 1:00 am:

* 1 * * * /scriptA

Run scriptB at every 15 minutes past the hour:

15 * * * * /scriptB

Run scriptC on the hour and every 30 minutes past the hour:

0,30 * * * * /scriptC

Run scriptD at 10,11 and 12, every Monday:

* 10-12 * * 1 /scriptC

To install the crontab setings, run:

crontab filename

To list the current crontab settings:

crontab -l

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.