Search code examples
amazon-web-servicescronamazon-redshift

AWS redshift schedule for specific days using CRON


I'm trying to set up Redshift scheduling using CRON for running it 5 days a week (MON-FRI) between 7-14 ETC. The format is described as such:

Cron format: minute hour day-of-month month day-of-week year 
Use , (comma) to include additional values, - (hyphen) to specify a range, * (asterisk) to include all values, and / (forward slash) to specify increments.

So I use these values:

Pause - 0 16 * * 1-5 * Start - 0 9 * * 1-5 *

AWS shows me an error Invalid cron schedule expression: cron(0 9 * * 1-5 *). If I substitute 1-5 by ?, it works, but that's not what I need.

Is the range indeed supported by this scheduler and I'm doing something wrong?


Solution

  • The third asterisk has to be a question mark when specifying the day of the week like this: 0 16 ? * 1-5 *

    The doc says:

    The * (asterisk) wildcard includes all values in the field. In the Hours field, * would include every hour. You cannot use * in both the Day-of-month and Day-of-week fields. If you use it in one, you must use ? in the other.