Skip to content

Instantly share code, notes, and snippets.

@webmechanicx
Last active February 4, 2020 16:55
Show Gist options
  • Save webmechanicx/ec6f804131d743ff89c36739b16fff4a to your computer and use it in GitHub Desktop.
Save webmechanicx/ec6f804131d743ff89c36739b16fff4a to your computer and use it in GitHub Desktop.
Setup AWS Cronjob

Setup Cronjob in Amazon AWS

Step:1

$ crontab -e

Step:2

Press i

Enter your cronjob entries per line. Cron expression:

Cron Expression Examples:

* * * * *      // Run every minute. ex: for 5 mins => */5 * * * *

0 * * * *      // Run on the hour, every hour ex: every 2hrs => * */2 * * *

0 23 * * *     // Run at 11 p.m. every day

0 0,12 * * 6   // Run at midnight and midday every Saturday

30 2 */2 * *   // Run every second day at 2.30 a.m.

5 stars are explained below:*

1st star:     Minute (ranges from 0-59)

2nd star:     Hour  (ranges from 0-23)

3rd star:     Day (ranges from 1-31)

4th star:     Month(ranges from 1-12)

5th star:     Day-of-week (0-7. 0 & 7 is Sun. 1-Mon, 2-Tue...etc)

Example cronjob looks like:

0 23 * * * curl --silent https://yourdomain.com/cronjob.php

Step:3

Press ESC

Step:4

Exit and save the vi editor

Press ZZ (shift+zz)

Reference

First Link

Second Link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment