zapty / forever-service

Provision node script as a service via forever, allowing it to automatically start on boot, working across various Linux distros and OS
https://github.com/zapty/forever-service
MIT License
594 stars 65 forks source link

Explicitly set sysvinit or upstart for the service #19

Closed andrew-vant closed 9 years ago

andrew-vant commented 9 years ago

Feature request: It would be nice to have a command line option to explicitly set whether you want a sysvinit or upstart style service to be created.

(I am also wondering exactly how forever-service determines which to use; I haven't been able to figure it out looking at the source)

arvind-agarwal commented 9 years ago

@andrew-vant What scenario do you feel it will be helpful to have that choice?

Currently the decision is based on the OS, (e.g. https://github.com/zapty/forever-service/blob/master/templates/sysvinit/installer.js)

One complication for this would be that in every os the service provisioning behavior is also different hence this would require lot of testing and is not as simple as just switching the templates.

Hence my current thought is the feature may not be worth the effort.

andrew-vant commented 9 years ago

Okay, fair enough. I'm less interested in controlling the method than I am with predicting which method it's going to use. I'm writing a configurator for something using Salt, and the method I'm using to execute forever-service (see here, in particular the Creates option) needs to be fed the full path of the file it's creating so that it can check if it's already been run -- which means I need to know the full path, in advance. Specifying the method seemed like the simplest way to be sure.

If I'm reading the file you linked and the equivelant upstart file right, it uses upstart with Ubuntu and sysvinit with everything else. Knowing that is probably enough for what I'm doing.

arvind-agarwal commented 9 years ago

So just displaying location of service config file will help you? Since that can be easily added as an output while provisioning the service?

andrew-vant commented 9 years ago

No; my trouble is that I need to know where it's going to go before forever-service gets run (because forever-service will only be run if the file isn't already there). As above, now that you've pointed me to the code that makes that decision, I can work out my own problem. You can close this if you want.

(although I think adding it as output might be a good idea in general)