Last active
December 26, 2015 19:44
-
-
Save subkitio/979e8344bd501835db28 to your computer and use it in GitHub Desktop.
A cron job
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let counter = 0; | |
const CronJob = require('cron').CronJob; | |
let cronJob = new CronJob('0 */1 * * * *', | |
() => console.log(`${counter++}: You will see this message from a cron job every minute!`), | |
() => console.log('You will see this message on cron job done!'), | |
true); | |
//Stop cron onCleanup | |
this.onCleanup = () => cronJob.stop(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment