首页 > 解决方案 > Nodejs-cron for logging

问题描述

Hi I'm trying to make a cronjob for From this month on, they will work at 10.00 pm on the first day of each month. My try is ( i created this from cron-expression-generator )

var job = new CronJob('0 0 12 1 1/1 ? *', function() {

  let UserCount=0;
  User.count({}, function( err, count){    
   
      console.log(count);
 
  });

}, null, true, ' ..somewhere_in_world..');
job.start();

But it gives error

throw new Error('Too many fields');

Also it works fine as every second like

var job = new CronJob('* * * * * *', function() {

How can I make it Thank you

标签: node.jscron

解决方案


我相信您的问题已经得到解答,只需添加很酷的网站链接以在将来提供帮助

https://crontab.guru/


推荐阅读