javascript - Node-cron jobs running on fixed week-days - Stack Overflow

I know this might sound a bit dumb, but can I use node-cron to create two crone-jobs to run on two days

I know this might sound a bit dumb, but can I use node-cron to create two crone-jobs to run on two days of the week which are non-consecutives? Do I need to call two CronJob functions, or is there a way to use only one?

I know this might sound a bit dumb, but can I use node-cron to create two crone-jobs to run on two days of the week which are non-consecutives? Do I need to call two CronJob functions, or is there a way to use only one?

Share Improve this question asked Nov 2, 2016 at 18:23 CorradoCorrado 6651 gold badge8 silver badges17 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

Node-cron uses the same rules as crontab, so you can set a rule like this:

cron.schedule('30 3 * * sun,tue', function(){
  console.log('running a task at 3:30 on Sunday and Tuesday');
});

Note that this is only if you want to run the same job on both days. If you wan to run different jobs you have to create different tasks.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745287185a4620634.html

相关推荐

  • javascript - Node-cron jobs running on fixed week-days - Stack Overflow

    I know this might sound a bit dumb, but can I use node-cron to create two crone-jobs to run on two days

    5小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信