Skip to content

Instantly share code, notes, and snippets.

@techthoughts2
Last active October 6, 2023 03:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save techthoughts2/97dddec1400cfc07186565a3df801fa7 to your computer and use it in GitHub Desktop.
Save techthoughts2/97dddec1400cfc07186565a3df801fa7 to your computer and use it in GitHub Desktop.
Scheduled cron expressions and examples of using cron to scheudle things in AWS
cron(Minutes | Hours | Day-of-month | Month | Day-of-week | Year)
cron(0 0/4 * * ? *) Every 4 hours
cron(0 10 * * ? *) 10:00AM UTC everyday
cron(15 12 * * ? *) 12:15PM UTC everyday
cron(0 18 ? * MON-FRI *) 6:00PM UTC every Mon-Fri
cron(0 8 1 * ? *) 8:00AM UTC every first day of the month
cron(0/10 * ? * MON-FRI *) Every 10 min Mon-Fri
cron(0/5 8-17 ? * MON-FRI *)Every 5 minutes Mon-Fri between 8:00AM - 5:55PM UTC
cron(0 9 ? * 2#1 *) 9:00AM UTC first Monday of each month
Minutes 0-59 , - * /
Hours 0-23 , - * /
Day-of-month 1-31 , - * ? / L W
Month 1-12 or JAN-DEC , - * /
Day-of-week 1-7 or SUN-SAT , - * ? / L #
Year 1970-2199 , - * /
/ Specifies increments 0/15 in the minutes field directs execution to occur every 15 minutes.
L Specifies "Last" If used in Day-of-month field, specifies last day of the month. If used in Day-of-week field, specifies last day of the week (Saturday).
W Specifies Weekday When used with a date, such as 5/W, specifies the closest weekday to 5th day of the month. If the 5th falls on a Saturday, execution occurs on Friday. If the 5th falls on a Sunday, execution occurs on Monday.
# Specifies the nd or nth day of the month Specifying 3#2 means the second Tuesday of the month (Tuesday is the third day of the 7-day week).
* Specifies All values If used in the Day-of-month field, it means all days in the month.
? No specified value Used in conjunction with another specified value. For example, if a specific date is specified, but you don't care what day of the week it falls on.
- Specifies ranges 10-12 would mean 10, 11 and 12
, Specifies additional values SUN,MON,TUE means Sunday, Monday and Tuesday
/ Specifies increments 5/10 means 5, 15, 25, 35, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment