参数 ScheduleExpression 无效 [英] Parameter ScheduleExpression is not valid

查看:52
本文介绍了参数 ScheduleExpression 无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置 Cloudwatch 计划事件,但我的 cron 表达式似乎无效,但我不知道为什么.

I'm trying to setup a Cloudwatch Scheduled Event and my cron expression seems to be invalid, though I can't figure out why.

我的 cron 表达式是:

My cron expression is:

cron(5,15,25,35,45,55 * * * *)

cron(5,15,25,35,45,55 * * * *)

我希望它在每天每小时的第 5、15、25、35、45 和 55 分钟运行.这似乎与 http://docs 中的 AWS Scheduled Events 文档一致.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html.

I want it to run on the 5th, 15th, 25th, 35th, 45th and 55th minute of every hour of every day. This seems to coincide with the AWS Scheduled Events documentation here http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html.

上述文档允许使用 0 到 59 之间的逗号分隔值表示分钟,并使用 * 通配符来反映小时、月份(或星期几)、月份和年份全部.

The above documentation allows for minutes to be represented with comma separated values between 0 and 59, and hours, day-of-month (or day-of-week), month and year to be reflected with a * wildcard to reflect ALL.

我尝试在 Lambda 控制台(创建函数并选择 Cloudwatch Schedule Event 时)和 Cloudwatch 控制台(以及选择触发器的目标)上设置 cron 表达式.两者都不适用于我的自定义 cron 表达式.

I have tried setting the cron expression on the Lambda console (when creating the function and choosing Cloudwatch Schedule Event), and in the Cloudwatch console (along with choosing the target of the trigger). Neither worked with my custom cron expression.

我尝试了以下方法:

5,15,25,35,45,55 * * * *
5,15,25,35,45,55 * ? * *
cron(5,15,25,35,45,55 * * * *)
cron(5,15,25,35,45,55 * ? * *)

每次我收到一条错误消息,说 ScheduleExpression 无效.但是,我可以使用预制的 rate() 表达式之一.

Everytime I get an error saying the ScheduleExpression is not valid. I can, however, use one of the premade rate() expressions.

如何使用我自己的自定义 cron 表达式?

How can I use my own custom cron expression?

谢谢.

推荐答案

Could you try : cron(5,15,25,35,45,55 * * * ? *)

Could you try : cron(5,15,25,35,45,55 * * * ? *)

Cron 表达式在这里有六个必填字段.

Cron expressions have six required fields here.

AWS 文档

另外,不要错过这个重要的通配符注释...

Also, don't miss this important wildcard note...

不能在 Day-of-month 和 Day-of-week 字段中使用 *.如果您将其合二为一,则必须使用 ?在另一个.

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.

这篇关于参数 ScheduleExpression 无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆