Tuesday, 6 August 2019

Cron job registered by Node-cron won't execute unless application is running.

I must be misunderstanding something here. I register a cron job by running:cron.schedule('50 17 * * *', () => { notifier.notify(//some notification logic) }) And I'm expecting a notification to run on my machine every day at specified time. If it's registered as a task on the machine, then I'd have thought it would persist outside the application's runtime. However, this does not seem to be the case. Running this code and then ending the application process does not lead to a notification at the specified time. That only occurs if the application is running when that time comes along. So my question is: is there a way to persist this job such that it runs outside of the application?

Submitted August 06, 2019 at 01:12PM by HUMBLEFART

No comments:

Post a Comment