1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/utility/daemon
Giovanni Marzot b6f5ea812b
Support stop msg for daemon node (#1018)
* add msg.stop handler and docs, msg.start restarts process as per existing doc

* stop process using configured signal

* fix grunt complaint

* remove extra debug, make start only start and change doc to match
2023-08-05 17:14:22 +01:00
..
locales Add specific daemons node stdin error handler 2022-11-16 12:02:30 +00:00
daemon.html Add Japanese translations for daemon Node (#843) 2021-10-18 21:12:00 +01:00
daemon.js Support stop msg for daemon node (#1018) 2023-08-05 17:14:22 +01:00
LICENSE Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
package.json Add specific daemons node stdin error handler 2022-11-16 12:02:30 +00:00
README.md Support stop msg for daemon node (#1018) 2023-08-05 17:14:22 +01:00

node-red-node-daemon

A Node-RED node that runs and monitors a long running system command.

Similar to the exec node - but this calls the command at start time and then pipes any input to the node to the STDIN of the running command, and feeds any STDOUT to the first output.

Useful for monitoring command line based processes.

Install

Either use the Editor - Menu - Manage Palette - Install option or run the following command in your Node-RED user directory - typically ~/.node-red

npm i node-red-node-daemon

Usage

Calls out to a long running system command. Sends msg.payload to stdin of the process.

Note Only the command itself should be placed in the command field. All parameters must be placed in the arguments field.

The command provides 3 outputs... stdout, stderr, and return code, from the running command.

If the called program stops (i.e. a return code is produced), this node can attempt to restart the command automatically.

Setting msg.kill to a signal name (e.g. SIGINT, SIGHUP) will stop the process - but if the restart flag is set it will then auto restart.

Sending msg.start will start the process, if not already running. Additional arguments can be specified in msg.args.

Sending msg.stop will stop the process and prevent automatic re-start until reset with msg.start.

Note: Some applications will automatically buffer lines of output. It is advisable to turn off this behaviour. For example, if running a Python app, the -u parameter will stop the output being buffered.

For example it can be used to run and then monitor the dump1090 plane spotter, and also to interact with various python apps that everyone seem to write these days :-)