jaumard / sails-hook-schedule

Hook to manage basic cron job for sails application
21 stars 6 forks source link

Can it run the job only once? #1

Closed wassimsalib closed 9 years ago

wassimsalib commented 9 years ago

I have a job that needs to run once after the sails server is lifted and It has to run on parallel to so it doesn't block the incoming connections, so can this module allow this? Thanks

jaumard commented 9 years ago

You don't need this module to do this I think... Put your job under config/bootstrap.js and if it's separate as sails create a new node process. This module only works with cron job witch is repetitive task so I don't think you can do it with this module.

wassimsalib commented 9 years ago

Great, thanks for the quick reply, so you mean create another node process dynamically or you mean 2 different apps running at the same time?

jaumard commented 9 years ago

You're welcome :) Depend of what you are trying to do, under config/bootstrap.js you can create another node process dynamically I think if you second project is dependent to the first if they are 2 independent project 2 different apps is better.

wassimsalib commented 9 years ago

I have tried to use sails.on('lifted',function(){}) , but that is still didn't solve my problem, it still blocks the web server.

Best Regards, Wassim Salib

On Mon, Aug 17, 2015 at 3:25 AM, Jaumard notifications@github.com wrote:

You're welcome :) Depend of what you are trying to do, under config/bootstrap.js you can create another node process dynamically I think if you second project is dependent to the first if they are 2 independent project 2 different apps is better.

— Reply to this email directly or view it on GitHub https://github.com/jaumard/sails-hook-schedule/issues/1#issuecomment-131742148 .

jaumard commented 9 years ago

Yes cause you don't create another node process, look this tutorial it will help you I think http://jlunaquiroga.blogspot.fr/2014/03/creating-processes-in-nodejs.html

wassimsalib commented 9 years ago

Awesome, thanks a lot :+1: