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.

execute a job at every 3 hours of every day -help

See original GitHub issue

Hi, noob to this cron world I want o execute a job at every 3 hours of every day

var rule = new schedule.RecurrenceRule();
rule.dayOfWeek = [0,6];
rule.hour = 17; // can i add multiple times [06,9,12,15,...]
rule.minute = 0;

var j = schedule.scheduleJob(rule, function(){
  console.log('Today is recognized by Rebecca Black!');
});

or which seem too long

var rule1 = new schedule.RecurrenceRule();
rule1.dayOfWeek = [0,6];
rule1.hour = 06; // set at 6 am
rule1.minute = 0;

var rule2 = new schedule.RecurrenceRule();
rule2.dayOfWeek = [0,6];
rule2.hour = 09; // set at 9 am
rule2.minute = 0;
...

var j = schedule.scheduleJob(rule1, function(){
  console.log('Today is recognized by Rebecca Black!');
});
var j = schedule.scheduleJob(rule2, function(){
  console.log('Today is recognized by Rebecca Black!');
});
..

any help would be appreciated

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rguedescommented, Apr 6, 2016

Hi, Try this: var j = schedule.scheduleJob('0 0 */3 * *', function(){ console.log('The answer to life, the universe, and everything!'); });

0reactions
santigimenocommented, Dec 7, 2016

@vcasadei use a Range:

rule.hour = new schedule.Range(19, 22);
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cron job every 3 hours - Crontab.guru
Cron job every 3 hours is a commonly used cron schedule. We created Cronitor because cron itself can't alert you if your jobs...
Read more >
Run a scheduled job for every 3 hours - ServiceNow Community
yes if you want to run it every 3 hours, then day should be 0 so that it runs every 3 hours from...
Read more >
How to set a cron job to run every 3 hours - Stack Overflow
Is this the correct way for setting a cron job to run every 3 hours? After setting it this way, cron is executing...
Read more >
How to set Cron job that run after every three hours for ...
You should be able to use the following line to run a job every 3 ... To check whether your cron job ran,...
Read more >
Cron job every 3 hours - Cron Expression To Go
Cron Expression To Go. Cron expression to run a job every 3 hours. "At 0 minutes past the hour, every 3 hours". next...
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