question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cron runs twice at the set time

See original GitHub issue

I want to run it every 5 minute from 8-22. It runs two times every 5 minutes.

I am using node-schedule version 1.0.0 with node version 5.0.0.

  var schedule = require('node-schedule');
  var postman = schedule.scheduleJob('0 */5 8-22 * * *', postmanFunction);

Any help would be appreciated.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:53 (21 by maintainers)

github_iconTop GitHub Comments

7reactions
NgocSon159commented, Dec 24, 2020

I was able to solve it, the problem was due to the multiple clusters node was running on. As in my case node was running on two clusters so it executed the job twice.

var cluster = require('cluster');
if(cluster.worker.id == 1){
 // run job
}

Thanks you so muchhhhh.

7reactions
arsinawazcommented, May 11, 2016

I was able to solve it, the problem was due to the multiple clusters node was running on. As in my case node was running on two clusters so it executed the job twice.

var cluster = require('cluster');
if(cluster.worker.id == 1){
 // run job
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is this cron entry executed twice? - Stack Overflow
This entry works but every 5 minutes it gets executed twice, why? In /var/log/cron it shows: Jun 16 22:20:01 Test CROND[12512]: (root) ...
Read more >
Resolved - My cron jobs runs twice - Plesk Forum
Problem begins when I have noticed awhile that all cron job tasks are marked as disabled, but they were actually running.
Read more >
What could cause a cron to run twice at the same moment?
The first explanation that comes to me is that someone manually set the clock, or has set up a script that forcefully resets...
Read more >
Why is cron running twice? - Server Fault
I wanted to execute my PHP mailing-script automatically with cron. I always get the mail twice though. The script runs fine when started ......
Read more >
Cron job twice a day (at 09:00 and 21:00)
Cron Expression To Go. Cron expression to run a job twice a day at 9am and 9pm. "At 09:00 and 21:00". next at...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found