How to stop Node-RED (OTHER THAN THE OBVIOUS WAYS)?

1,971 views
Skip to first unread message

Heath Thomann

unread,
Jan 30, 2018, 5:11:15 PM1/30/18
to Node-RED

HI!  Is there really no way to stop Node-RED (well, node.js server) automatically/automated?  I know, I know, you can do a ctrl+c, or kill <pid> on unix and the like, or ‘taskkill /F /IM node.exe’ on windows.  However, there are problems with this, at least for taskkill (i.e. taskkill required admin authority), and possibly sudo type of issues elsewhere.  My product starts Node-RED on behalf of a user.  When my product shuts down, I need to stop Node-RED.  At least on Windows (I haven’t tried on unix/linux or mac) my product can’t do taskkill because it doesn’t have to ‘run as admin’.  Having used WebSphere for years, I’m used to a command to start the server, and a command to stop the server.  It would be nice if Node-RED did the same.  😊  Is there a reason it can’t?  I suspect it has something to do with node.js??  I know very little about node.js but my guess is that once the red.js file executes and returns, there is no way to get, from an external command, the “process” red.js was given?? 

 

Sincerely,


Heath Thomann

Stephen Mann

unread,
Jan 30, 2018, 5:46:46 PM1/30/18
to Node-RED
I am not trying to be flippant, but... why?
My Node Red is running on a Raspberry Pi3 in a closet, and it hasn't been shut down for a couple of months.  I wish my PC were that reliable.

Steve Mann

Dean Cording

unread,
Jan 30, 2018, 8:27:16 PM1/30/18
to Node-RED
I use pm2 to run Node Red on my headless server.  It has commands to start, stop, and restart Node apps.

Colin Law

unread,
Jan 31, 2018, 2:09:58 AM1/31/18
to node...@googlegroups.com
I don't know about Windows but I think that on Linux if you start it as a child process of your app then it will be shutdown when the main process terminates.  Presumably there is something similar in Windows.

Colin

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/ddbc4fda-6259-4ca3-a896-81eee52a985f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julian Knight

unread,
Jan 31, 2018, 9:49:59 AM1/31/18
to Node-RED
Hi Heath, it really depends on how you start it in the first place. If your product is Node.JS based, you can simply embed Node-RED so you don't have to worry about it. If it is .net then you could possibly capture the PID as you spawn the Node.JS process and send a SIGINT (?) to it. 
Reply all
Reply to author
Forward
0 new messages