The node-cron module is tiny task scheduler in pure JavaScript for node.js based on GNU crontab. This module allows you to schedule task in node.js using full crontab syntax.
Questions tagged [node-cron]
198 questions
22
votes
1 answer
node-cron run job every 3 hours
I am trying to run a node-cron job every 3 hours and I am not sure if I am doing it right.
Right now I am using:
* * */8 * * *
Is this correct?

Bob
- 741
- 2
- 9
- 18
12
votes
3 answers
Heroku and node-cron?
So I know Heroku's free dynos 'wind down' when there isn't any traffic to them– how would this effect the cron jobs that I've implemented using the node-cron module?

dshidham
- 125
- 1
- 6
10
votes
1 answer
How to make a Cron job for a typescript class method
In Typescript, I have a controller class that has a method that I want to run daily at 5am.
My first thought was to schedule something using node-cron or node-scheduler, but these seem to be strictly for node projects, not typescript.
What I need to…

Curiosity
- 149
- 1
- 2
- 11
7
votes
3 answers
How to schedule node-cron job every new month?
I am using node-cron package for scheduling node-cron jobs. I want to schedule an node-cron job which will run every new month.
for example:
My node-cron job should run at 1 September 2020 after that it should run at 1 October 2020 and and so…

Akshay Kashid
- 79
- 2
- 6
7
votes
2 answers
Get next cron job timing in node-cron
In node-cron, how do I get the timing of the next cron-job? e.g. cronJob.nextCronJob().time, or other properties. There are no methods in the documentation to show this.

Solobea
- 83
- 1
- 4
7
votes
4 answers
How to stop a node cron job
I want to stop a node cron job on certain conditions.
This is how I started the task to run every 1 second.
const runScheduler = (url)=>{
cron.schedule('*/1 * * * * *', () => {
console.log('running a task every one second');
…

Rohan
- 71
- 1
- 1
- 2
7
votes
1 answer
Node.js CronJob execution when using mocha for testing
So, I've got some js code which is a slackbot which supposed to simply listen and parse the date provided, then start a CronJob to run a certain function according to the cron or date format provided. Something like this.
var CronJob = require…

Lucas Rudd
- 385
- 1
- 13
5
votes
2 answers
Edit the tasks created using node-cron
Trying to run the tasks based on schedule using node-cron 'https://github.com/merencia/node-cron'.
Task creation and starting it:
var cron = require('node-cron'),
task = cron.schedule('* * * * * *', function () {
console.log('task…

Arvind
- 61
- 1
- 3
5
votes
1 answer
Node-cron jobs running on fixed week-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?

Corrado
- 645
- 1
- 6
- 16
4
votes
1 answer
fs.writeFile (node) adds information on an already existing file instead of replacing this
I made a code to write a file using fs and node-cron to run this every x minutes. I get the data the first time, but in the next job I get the data added again in the file and the old one too, I wan to create a new file and replace the old one (and…

Mariano Bordon
- 41
- 1
4
votes
0 answers
How can I monitor node-cron queued jobs?
I recently started using node-cron as a job scheduler. I have a lot of jobs that are being queued.
Is there a way I can monitor them using a visual tool (something like Agendash does for Agenda)?
Or how would you monitor and debug jobs in general?…

sebmild
- 41
- 2
4
votes
1 answer
Is there any way to get milliseconds in CronJobs?
I want to trigger a JavaScript function every 500ms using node cron jobs, though I couldn't find a way to make the cron execute any lower than a 1 second interval.
cron.schedule("*/1 * * * * *", function() {
console.log("running a task every 1…

Kavishka
- 231
- 3
- 11
4
votes
1 answer
node-cron timezone working only when time-zone is same as machines time zone
EDIT: - this has been resolved in "node-cron" version > "3.0"
I have the following code. "node-cron": "^2.0.3"
cron.schedule('46 00 * * *',() => {
//code to be executed
console.log("Tik")
},{
scheduled: true,
timezone:…

amar
- 4,285
- 8
- 40
- 52
4
votes
0 answers
Does node-cron run tasks in parallel?
I have some scheduled tasks in my node app. These are scheduled using node-cron. I just want to confirm onething. By using node-cron, will these tasks be executed in parallel? I am aware that node.js is single threaded. By using node-cron, will I be…

Ganesh Kumar
- 3,220
- 1
- 19
- 27
3
votes
1 answer
Task Scheduling / CRON Jobs on NestJS + Serverless / Lambda
We are looking to deploy a NestJS application (using Express) to AWS Lambda (or similar) using the Serverless framework (or similar).
How should we handle scheduled tasks / cron jobs?
I notice in the NestJS documentation that NestJS has an official…

rbutera
- 153
- 3
- 15