博客园  :: 首页  :: 管理

关于aws-Lambda的cron周期性计划任务-表达式的定义方式

Posted on 2021-07-03 09:43  520_1351  阅读(658)  评论(0编辑  收藏  举报

关于aws-Lambda的cron周期性定时任务的定义方式,与其他系统或者语言可能略有差异

区别之一,就是Lambda是6个字段的, (分,时,日,月,周,年),多了一个年份字段,各字段之间使用空格隔开

cron(Minutes Hours Day-of-month Month Day-of-week Year)

关于cron的一些示例(特别注意,cron定义的日期时间,都默认是指的UTC +0),如下:

对于星期几,还可以使用1~7表示,不过1代表的是星期天,7代表的就是星期六,笔者工作中曾经配置过如下

# 即,UCT +8 我们本地时区,每周六的中午12点10分执行
cron(10 4 ? * 7 *)

还有两点需要注意一下(Note the following):

(1) If you are using the Lambda console, do not include the cron prefix in your expression.

(2) One of the day-of-month or day-of-week values must be a question mark (?).

 

 

 

尊重别人的劳动成果 转载请务必注明出处:https://www.cnblogs.com/5201351/p/14965641.html