Skip to content

Instantly share code, notes, and snippets.

@neilrenicker
Last active October 12, 2015 04:25
Show Gist options
  • Save neilrenicker/f03847d07561d547a6e9 to your computer and use it in GitHub Desktop.
Save neilrenicker/f03847d07561d547a6e9 to your computer and use it in GitHub Desktop.
article: https://medium.com/p/c902269fd11e/ -- Automate Stuff With A Dead Simple Node Worker
// Reference the node-schedule npm package.
var schedule = require('node-schedule');
var APP = {
scheduleJob: function() {
// This rule is standard cron syntax for once per minute.
// See http://stackoverflow.com/a/5398044/1252653
rule = '* * * * *'
// Kick off the job
var job = schedule.scheduleJob(rule, function() {
console.log('ping!')
});
},
init: function() {
APP.scheduleJob();
}
};
(function(){
APP.init();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment