Answer the question
In order to leave comments, you need to log in
How to run cron dynamically?
I'm implementing dynamic cron launch. How to stop the old cron before starting the new one?
function test() {
db.test.findOne({id: 1},)
.then(res => {
if (!res)
return Promise.reject('Period backup not found');
let job = cron.schedule(res.cronTime, function () {
test1();
});
console.log(job)
})
}
cron.schedule('* * * * *', () =>
test();
return true;
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question