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.

Multiple Cron Jobs

See original GitHub issue

I’ve noticed other issues regarding this, but multiple scheduled jobs do not seem to work in all cases (LTS Node v4.xx). Example can be seen below…I understand there could be a buried issue but the code within these jobs is not complex (one checks mongo and sends email on condition, one cleans temp folder).

new CronJob('* 1 * * * *', function() {
        // Stuff here 
    }, null, true, 'America/Chicago');

new CronJob('* 5 * * * *', function() {
       // More stuff here
    }, null, true, 'America/Chicago');

The debug statements placed in these functions do not fire. The first one was working fine, when I added a second neither seem to fire.

Thanks, G

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
SEAPUNKcommented, Dec 6, 2017

just ran this code, and it worked completely fine for me:

screen shot 2017-12-06 at 10 41 18 am

note that the second number is the “hour”, since you’re only providing five numbers to the cron string

5reactions
gcaraciolocommented, Apr 26, 2016

This could be more explicit in the documentation

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple Cron jobs in one crontab file - Stack Overflow
I wanted to implement two cronjobs with different execution time. One cron job is for sending emails and second cron job for validating...
Read more >
How to Run Multiple Commands in the Same Cron Job
You can use two options to set multiple commands in the same cron job. 1. Use the &&: the double ampersand specifies that...
Read more >
How do I setup two cron jobs to run every night at 3:00 and 3 ...
Open a terminal ( Ctrl + Alt + T ) then run: crontab -e. If it asks you to select an editor, choose...
Read more >
Cron Jobs: A Comprehensive Guide - SitePoint
This guide covers the basics of cron jobs, as well as some more advanced features. ... Multiple Commands in the Same Cron Job....
Read more >
How to Run Multiple Commands in One Cron Job - TecAdmin
It allows us to schedule multiple cron jobs to run at once. We can schedule any shell command or script to can be...
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