Skip to content

Instantly share code, notes, and snippets.

@subkitio
Last active December 26, 2015 19:44
Show Gist options
  • Save subkitio/979e8344bd501835db28 to your computer and use it in GitHub Desktop.
Save subkitio/979e8344bd501835db28 to your computer and use it in GitHub Desktop.
A cron job
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