Questions tagged [node-cron]

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.

198 questions
0
votes
2 answers

Difference between node-cron and setInterval()

I need to repeat a backend task every hour. I've read that node-cron is good for that. But why not just setInterval(). What is the difference?
rayanJ
  • 61
  • 7
0
votes
1 answer

Sync node-cron with system time

I want to know if I can change system time on computer for node-cron to re-run?, if not how can I test a function that runs every month without waiting for a month
0
votes
1 answer

How to stop duplicate execution of scheduler jobs in cluster

We have a node application which uses scheduled jobs, My scheduled job is working 6 times in a day. Now we are going to upgrade the node application into cluster based, I mean master and worker nodes. By doing that i see that jobs are duplicated and…
0
votes
0 answers

node-cron timing system for hours after 12 am

Quick question: I know that this: cron.schedule(`0 8 * * *`) Sets the schedule for 8am. What would it need to be for 8pm?
Juliette
  • 4,309
  • 2
  • 14
  • 31
0
votes
0 answers

Node JS cron function triggering multiple times

I like to run some set of async codes (eg. push notifications) for every one hour. But it's firing my function 2 times, 3 times randomly. But I need to fire that function only for one time for an hour. My code given below var Job = new…
Ranjit
  • 1
  • 1
0
votes
0 answers

How to clear up cron jobs that do nothing in nodejs

I am a new developer trying to build a todo app in nodejs with graphql and mongodb. I want to schedule some tasks which would come under routine things that the user would want added to their daily list of tasks. I decided to use node-cron for this…
Ripul
  • 41
  • 1
  • 2
0
votes
0 answers

Stopping node-cron cron.schedule if a condition is met inside it

var cron = require('node-cron'); cron.schedule('*/10 * * * *', () => { for(var i = 0; i < datas.length; i++) { if (datas[i].price > 10 && datas[i].price < 300) { const transporter = nodemailer.createTransport({ …
Samy93
  • 3
  • 4
0
votes
0 answers

Launch the exact same node.js script multiple times in node-cron

I was trying to launch the exact same node.js script in my code via node-cron. const cron = require("node-cron"); const Bot = require("./bot"); // Scheduled to run at 10:00 AM cron.schedule("0 10 * * *", () => { for(int I=0; I<5; I++){ …
A.Bokizh
  • 115
  • 1
  • 2
  • 8
0
votes
2 answers

Booking reminder Nodemailer node-cron MongoDB

I am having problem sending a booking reminder email. I use nodemailer and node-cron. It works good. I would like to read date from database and e.g. send email one week before reservation. I have no idea how to do it. My model: start_time: { …
LOL
  • 29
  • 6
0
votes
2 answers

node-cron tasks terminated after restart the server

The project in which I am working completely dependent on cronjobs functionality like firebase push notification 1 day before the subscription expires. the problem is when I restart the server all cron jobs are terminated. how can I solve this
Spandan Joshi
  • 809
  • 10
  • 11
0
votes
1 answer

How do I get my discord bot to play music from YouTube (without link)?

I'm very new to this. I've made a bot for discord and now i want it to play music from YouTube, without having to put in a link. I'm using Heroku and am getting several errors, that I really need help with. I have tried pushing it several times, but…
0
votes
2 answers

Node cron running for every 7 days after a particular date

Here is the code which runs a task every 7 days. cron.schedule('0 0 */7 * *',()=>{ console.log('Task running every 7 days') }); Now I want to run this only after a particular date, say tomorrow. How can I implement it? Can someone help?
loksan
  • 157
  • 3
  • 17
0
votes
1 answer

node-cron: I got the error: listen EADDRINUSE: address already in use

I use node-cron to run the program at regular basis. I run the following code, but I got the error below that says the port is already in use. I run node.js programs from command prompt in windows 10. Once I got this error, I closed the command…
Herbert
  • 540
  • 1
  • 6
  • 18
0
votes
2 answers

Is there a way to start a job immediately in cron and then stop it after the execution is completed?

I just started using cron, but I can not find a way to schedule a one time job. What I have is working for me, but I want to know if there is a better way to achieve it. The code below creates a job and prints in console that it was created. I set…
Duncanista
  • 83
  • 1
  • 8
0
votes
0 answers

nodejs schedule with timezone and saving light

I'm trying to schedule some job on nodejs using node-sched (I've also tried node-cron-tz which supports timezones), on my current dev machine it works correctly and works fine.. on customer test/prod env it executes it 2 hours later. I need to…
advapi
  • 3,661
  • 4
  • 38
  • 73