How to get all the jobs scheduled with different names in node-schedule?

Issue

I want to get the list of all the jobs that are scheduled by node-schedule

 var scheduleIds = schedule.scheduleJob(scheduleId,rule, function() {
  console.log("HELLO")
   })    

here scheduleId is a unique key and there are multiple jobs running with different names. How can I find a job from its name and cancel it?

Solution

var schedule = require('node-schedule');
var scheduleIds = schedule.scheduleJob(scheduleId,rule, function() {
console.log("HELLO")
})

The schedule object that is created contains all the names of the jobs that are scheduled.

Answered By – Aditya_Anand

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published