I am trying to force my cron task to stop and actually want the whole nodeapp to stop after 5 executions, but nothing happens, the message "time to quit" keeps appearing in log every minute.
What is the best way to stop the cron job and the quit the whole docker?
const crone = require('node-cron');
let mucount = 0;
export const update = crone.schedule('1 * * * * *', () => {
if (mucount < 5) {
new UpdateController();
mucount++;
} else
{log.info("time to quit")
update.cancel();
update.stop();
server.close();
process.kill(process.pid);
process.exit(1);
throw new Error('Please exit');
}
},{ scheduled: false });