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

when does Graceful shutdown happens? #69

Open avyas opened 8 years ago

avyas commented 8 years ago

I have a script which many a times exits when an error is encountered. Have it on using forever service, Found that the service status is stopped, many a times.

is that something to do with graceful shutdown?

btw I have a node program with error, installed as a service and there I do not see the service status as stopped.

arvind-agarwal commented 8 years ago

I would advise you to look at your node app code and debug why it exits. This has nothing to do with graceful shutdown, graceful shutdown only ensures that services get a chance to do cleanup on request for stopping them.

avyas commented 8 years ago

Thanks for the answer. What could be the cases when the service could stop automatically ?

I have following in the log when my service stopped last time .

. . . . . error: restarting script because change changed error: restarting script because change changed error: restarting script because change changed error: restarting script because change changed error: Forever detected script exited with code: 143 error: Script restart attempt #1

events.js:72 throw er; // Unhandled 'error' event ^ Error: spawn ENOENT at errnoException (child_process.js:1001:11) at Process.ChildProcess._handle.onexit (child_process.js:792:34)

acrawly commented 8 years ago

Not sure if this should be asked here but how would I shutdown a service after it's installed? For example I do forever-service install my_app --script main.js. Now how do I stop and start that app manually?