每月第三个工作日的 Azure 函数 Cron 表达式

标签 azure cron azure-functions azure-web-app-service

是否有任何相关的 CRON 表达式可以在特定月份的该月的第三个工作日触发 azure 函数。我尝试了 cron 表达式“0 0 22 3W 2,5,8,11 ?”..CRON 表达式表示“2 月、5 月、8 月和 11 月,距离每月 3 号最近的工作日晚上 22:00:00”。它应该是相应月份的第三天。如果第三天是周末(星期六或星期日),则函数将在最近的工作日执行。但是在 Azure 中运行它时,我收到以下错误

“Microsoft.Azure.WebJobs.Host:索引方法“RefundProcessForAppliedForTimerTriggerFunction”出错。Microsoft.Azure.WebJobs.Extensions:计划表达式“0 0 22 3W 2,5,8,11?”未被识别为有效的 cron 表达式或时间跨度字符串。”

最佳答案

以下是计时器触发器的 cron 表达式的主要文档:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=in-process&pivots=programming-language-csharp#ncrontab-expressions

我相信你想要这样的东西:
'0 0 22 * 2,5,8,11 3'

我将其读作 2、5、8、11 月和一周的第 3 天的 22 小时。(一周中的某一天为 0-6,相信 0 是星期日

如果我误解了,您只想将第一个工作日指定为该月该周的第三天(每月第三个工作日一次)

那么你想要这个: 我相信你想要这样的东西:
'0 0 22 1-7 2,5,8,11 3'

具体示例如下:
https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=in-process&pivots=programming-language-csharp#ncrontab-examples

关于每月第三个工作日的 Azure 函数 Cron 表达式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72157738/

相关文章:

azure - 如何解决 COPY failed : file not found in build context or excluded in Azure Pipeline?

javascript - 类似于 Cron 作业的刷新 Angular 组件

c# - 在 Azure Functions 中使用 DurableOrchestration 时,无法将参数 'orchestrationContext' 绑定(bind)到类型 DurableOrchestrationContext

azure - 无法从 Azure 函数应用连接 Azure Database for PostgreSQL 服务器

Azure Cosmos DB 与 Firebase firestore 或 firebase 实时数据库相同吗?

python - 如何在完成后重新启动 python 脚本

linux - 用于更新 Deluged Interface IP 的 Bash 脚本无法作为 cron 作业运行,但在手动运行时有效

azure - 我可以在 azure 函数内执行多少个任务?

Azure Function cosmosDB 触发器托管标识不起作用

javascript - Azure 聊天机器人 token 服务器