Created
June 16, 2016 11:25
-
-
Save ermst4r/8b5030c46c7853c360cdb406e0b92898 to your computer and use it in GitHub Desktop.
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
<script> | |
module.exports.bootstrap = function(cb) { | |
_.extend(sails.hooks.http.app.locals, sails.config.http.locals); | |
// add the lines from here | |
// bootstrapping all the cronjobs in the crontab folder | |
var schedule = require('node-schedule'); | |
sails.config.crontab.crons().forEach(function(item){ | |
schedule.scheduleJob(item.interval,sails.config.crontab[item.method]); | |
}); | |
// It's very important to trigger this callback method when you are finished | |
// with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap) | |
cb(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment