如何管理节点。js cron每天在什么时候?

时间:2021-05-08 23:56:03

My problem is that i want to run cron job at 10:00 of night.

我的问题是我想在晚上10点运行cron job。

This is my code:

这是我的代码:

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

})

1 个解决方案

#1


3  

It's quite simple:

很简单:

Modify your code with the below code:

使用以下代码修改您的代码:

var job = new CronJob('0 22 * * *', function() {
 //will run at 10:00 PM everyday
})

For more information: https://www.npmjs.com/package/node-schedule

更多信息:https://www.npmjs.com/package/node-schedule

Here you can customize time according to you requirement: https://crontab.guru/#0_22___*

这里您可以根据您的要求定制时间:https://crontab.guru/#0_22___*

#1


3  

It's quite simple:

很简单:

Modify your code with the below code:

使用以下代码修改您的代码:

var job = new CronJob('0 22 * * *', function() {
 //will run at 10:00 PM everyday
})

For more information: https://www.npmjs.com/package/node-schedule

更多信息:https://www.npmjs.com/package/node-schedule

Here you can customize time according to you requirement: https://crontab.guru/#0_22___*

这里您可以根据您的要求定制时间:https://crontab.guru/#0_22___*