Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

260
Views
node-cron jobs list wont stop

Ive got an array of cron jobs in my project which trigger at different times. I want to ability to stop all of these jobs when an event is triggered and for them not to start again until also manually triggered.

My issue is, i can stop my jobs, but then they appear to start themselves back up again..

Ive confirmed this by adding an addition cron which just checks the status regularly. Initially, the status is 'scheduled', then when i trigger to stop the status changes to 'stoped' which is correct, and then after sometime each one will eventually update its status to 'scheduled' again. Whats doing this? Is there another way I can disable these jobs so they stay stopped until ive manually started them?

const cron = require('node-cron');

jobs.push(cron.schedule('5 1 * * 1,4', () => {
  func.runOne();
}));

jobs.push(cron.schedule('0 1 * * *', () => {
  func.runTwo();
}));

jobs.push(cron.schedule('0 2 * * *', () => {
  func.runThree();
}));

jobs.push(cron.schedule('30 2 * * *', () => {
  func.runFour();
}));


cron.schedule('*/10 * * * * *', () => {
  console.log(`checking the status of jobs for task`);
  jobs.forEach((job) => {
    console.log(`Job status is: ${job.getStatus()}`);
  });
});

exports.stopJobs = () => {
  jobs.forEach((job) => {
    job.stop();
  });
};

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!