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 badges1 Answer
Reset to default 7Node-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
评论列表(0条)