How to kill a scheduled cron job ?
See original GitHub issueI’m curious if I have a rest API that creates and schedules a cron job.
How could I cancel this cron job at a future point? Considering the reference to the job is now out of scope when I want to cancel it.
` I can start it but I can’t end it…
var cronJob = CRON.job(frequency, function()
{
updateFeedbackJob()
.then(result =>
{
printMessage("updateFeedbackJob()-> finished");
})
.catch(err =>
{
printMessage("updateFeedbackJob()-> failed");
printObject(err);
});
});
cronJob.start();
`
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to stop a currently running cron job? - Super User
First type ps aux to see what all processes are running. Then note down the PID of each process you want to stop....
Read more >How can I see/stop current running crontab tasks? - Ask Ubuntu
Firstly, use only one command per line in crontab. Change this crontab line: 00 10 * * * /usr/bin/wget LINK ; shutdown -h...
Read more >Kill all currently running cron jobs - Server Fault
To kill all processes for the user, you have a few options. I like: su - username then kill -9 -1. To see...
Read more >how to cancel the time scheduled cron job in java?
By using above code i can able to schedule cron job..but if want cancel the schedule time how can able to cancel or...
Read more >job schedule cron delete - Product documentation - NetApp
The job schedule cron delete command deletes a cron schedule. Use the job schedule cron show command to display all current cron schedules....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
how do I store the cron jobs to the database to kill it later?
@kamleshkarwande You get the reference to the job in two ways. Either by setting a variable when instantiating
var a = new Job()
and then callinga.stop()
via a closure or something else OR by not using an arrow function for the onTick in which case the scope of the function should be the job.Hope that helps.