I'm working on a NodeJS project where a PHP server will have control over starting and stopping a NodeJS socket server. The server will be started by a remote call via PHP however I am unsure of how to go about stopping a remote NodeJS server, as all answers I have found simply tell me to hit CTRL-C, which is not an option in this case. Does anyone know how to cause an end event in a tidy manner? Is there an event that can fine or is the best I can do to throw an exception?
You could always expose a route that calls process.exit();
Node API Docs: process.exit
I'd setup a kickstart script for your nodejs app in /etc/init.d then [start|reset|stop] from the command line. If it's on a remote machine you should look into your php app using passwordless SSH to start/stop remotely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With