EC2 Crontab Scheduling

Crontab is a job scheduling tool included with the Linux system pack. The first five elements relate to the execution date and time and are used to specify the frequency of the task execution.

A crontab file has the following fields in the following order:
minute(s) hour(s) day(s) month(s) weekday(s) command(s)

0 4 * * * sh /home/ec2-someuser/someScript.sh
This means the script “someScript.sh” file is to be executed every day at 4AM.

5 4 * * * sh /home/ec2-someuser/someScript.sh
This means the script “someScript.sh” file is to be executed every day at 4:05AM.

30 * * * * sh /home/ec2-someuser/someaction.sh
This instructs the script “someaction.sh” file to run every day and every 30 minutes.

30 23 * * * sh /home/ec2-someuser/someaction.sh
This implies that every night at 23:30, the script file “someaction.sh” is to be executed.

1 1 1 1 1 sh /home/ec2-someuser/someaction.sh
This means the script “someaction.sh” file is to be executed- “at 01:01 on day-of-month 1 and on Monday in January.”

Hope you find this article helpful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s