[英]Node cron job executes only first time on GCP App Engine
I have a problem executing a cron job in node/express application using node-cron library.我在使用 node-cron 库在 node/express 应用程序中执行 cron 作业时遇到问题。 The application is deployed on Google Cloud App Engine.
该应用程序部署在 Google Cloud App Engine 上。
I want to send automatic emails every day at 9 AM, but the cron only work in the first day and then never sends.我想每天早上 9 点发送自动电子邮件,但 cron 只在第一天工作,然后从不发送。
Here is my code:这是我的代码:
cron.schedule("0 0 9 * * *", () => {
sendEmails();
},{
scheduled: true,
timezone: "Europe/Paris"
});
Thanks谢谢
Here you have 2 issues.在这里,您有 2 个问题。 A cron expression have only 5 elements not 6.
一个 cron 表达式只有 5 个元素而不是 6 个。
Also according to your expression your cron will be excecuted on the dat 9 of each month另外根据您的表达,您的 cron 将在每个月的 dat 9 执行
probably you want something like this可能你想要这样的东西
You probably want to verify your cron expression with a tool like https://crontab.guru/您可能想使用https://crontab.guru/ 之类的工具来验证您的 cron 表达式
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.