Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cron expression in AWS CloudWatch: How to run once a week

In Amazon AWS CloudWatch it is possible to run a rule according to a schedule that is defined in a cron expression.

The rules for this are outlined here.

After some trying around, I wasn't able to compose an expression that will run once a week (e.g. at 4 pm on Sunday). The following attempts were rejected by CloudWatch with the message Parameter ScheduleExpression is not valid...

0 16 * * SUN * 0 16 * * 6 * 0 16 * * SUN-SUN * 0 16 * * 6-6 * 
like image 743
mxro Avatar asked Jul 07 '16 05:07

mxro


People also ask

What is cron expression in AWS?

For example, with a cron expression, you can define a rule that triggers at a specified time on a certain day of each week or month. In contrast, rate expressions trigger a rule at a regular rate, such as once every hour or once every day.

What is the cron expression for every 5 minutes?

“At every 5th minute.” Cron job every 5 minutes is a commonly used cron schedule. We created Cronitor because cron itself can't alert you if your jobs fail or never start.


1 Answers

Try 0 16 ? * 1 * The question marks "says" that it must no be executed everyday, so it must check the week day value.

like image 164
Conti Avatar answered Sep 29 '22 09:09

Conti