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.

Job crontab bug, runs every minute

See original GitHub issue

Hi everyone,

I have 11 crontabs running in my backend but my last 5 crontabs have unexpected run time, just one of them start bugged and still this until node service restart

This is an example of one of them

cron.schedule('* * */2 * *', () => {
    console.log('Executing upload photo notification', new Date());
  });

The schedule is [* * */2 * *] it should run at every 2 hours but runs every minute

Executing upload photo notification 2021-06-04T13:51:00.001Z
Executing upload photo notification 2021-06-04T13:52:00.001Z
Executing upload photo notification 2021-06-04T13:53:00.005Z
Executing upload photo notification 2021-06-04T13:54:00.001Z
Executing upload photo notification 2021-06-04T13:55:00.002Z
Executing upload photo notification 2021-06-04T13:56:00.002Z
Executing upload photo notification 2021-06-04T13:57:00.002Z
Executing upload photo notification 2021-06-04T13:58:00.003Z
Executing upload photo notification 2021-06-04T13:59:00.002Z
Executing upload photo notification 2021-06-04T14:00:00.002Z
Executing upload photo notification 2021-06-04T14:01:00.000Z
Executing upload photo notification 2021-06-04T14:02:00.006Z
[nodemon] restarting due to changes...
[nodemon] starting `node start.js`

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
koencocommented, Jun 10, 2021

According to crontab.guru:

* * */2 * * : “At every minute on every 2nd day-of-month.” * */3 * * * : “At every minute past every 3rd hour.”

Is this the behaviour you’re observing?

0reactions
dev99problemscommented, Jun 11, 2021

@koenco thanks a lot for your inside, I’m aware I could misuse the pattern itself, so really thankful for help here. I would say this is pretty much like the behaviour I observe, but not what I wanted to achieve 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

php - every minute cron job sometimes not running
The problem is that the job should run every minute. However, it randomly misses and as a result does not execute every minute....
Read more >
Cron bug
That is, minute and hour and month all need to match the current time plus either day-of-month or day-of-week need to match as...
Read more >
Bad minute crontab error
When cron reads each line of your crontab, if the line is not a comment it expects it to start with a valid...
Read more >
Run a Cron Job Every Minute
If you want to run a program or script in the background on Linux then cron job is very important. With the help...
Read more >
cron job executing every minute but should be setup to ...
A * in the minute field causes it to run every minute, as you're experiencing. A zero will cause it to run 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