Skip to content

Instantly share code, notes, and snippets.

@nkhil
Last active June 14, 2020 12:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nkhil/8620373de070b343add47533a4a3d35e to your computer and use it in GitHub Desktop.
Save nkhil/8620373de070b343add47533a4a3d35e to your computer and use it in GitHub Desktop.

Quick reference for using node-scheduler

Every 5 seconds

const x = schedule.scheduleJob('*/5 * * * * *', function() {
  console.log('The answer to life, the universe, and everything!');
});

Every 5 minutes

const x = schedule.scheduleJob('5 * * * * *', function() {
  console.log('The answer to life, the universe, and everything!');
});

To invoke the schedule:

x.invoke();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment