您好,我正在使用 Node 议程在我的应用程序 (https://github.com/rschmukler/agenda) 中定义作业。我有两个我不知道如何涵盖的用例
1) 例如,我希望作业每周二或每周三运行
2) 我希望作业每 5 日或 10 日运行一次。
我知道 Node 议程使用人工间隔 ( https://github.com/rschmukler/human-interval ) 来解释他们想要运行作业的频率,但我看到它只能解释天、周、月等单位。关于我如何做的任何想法可以涵盖我上面提到的两个用例吗?
对于用例 1,我发现我可以这样做(来自议程文档):
var weeklyReport = agenda.schedule('Saturday at noon', 'send email report', {to: 'another-guy@example.com'});
weeklyReport.repeatEvery('1 week').save();
agenda.start();
最佳答案
您可以使用 cron 格式:
1) weeklyReport.repeatEvery( "0 0 * * 1,4")
其中 1 是星期一,4 是星期四
2) weeklyReport.repeatEvery("0 0 1,15 * *")
这将在每月的 1 号和 15 号运行
关于angularjs - 为这些用例定义 Node 议程作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30996605/