1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
node-red/packages/node_modules/@node-red/nodes/examples/function/exec/03 - Run external command in spawn mode.json
2020-06-24 14:43:27 +01:00

1 line
2.1 KiB
JSON

[{"id":"2e7be550.92ddfa","type":"inject","z":"a7f52169.f6c4","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":160,"wires":[["53a714a8.1214dc"]]},{"id":"53a714a8.1214dc","type":"exec","z":"a7f52169.f6c4","command":"/bin/sh -c \"while true; do echo Hello; sleep 2; done\"","addpay":false,"append":"","useSpawn":"true","timer":"","oldrc":false,"name":"Repeat message output","x":410,"y":160,"wires":[["d1815f06.463f3"],["322d9b72.fc9194"],["2dbf8e03.2d6a52"]]},{"id":"7f351806.547908","type":"comment","z":"a7f52169.f6c4","name":"Execute external command in spawn mode","info":"Exec node can execute external command and can receive its standard output as a payload of first message. Standard error output can be received from second message. The exit code of the command can be obtained from `code` property of third message payload.\n\nIf `spawn mode` is selected, exec node returns the output as the command runs. \n\nSending `msg.kill` will kill a active process.\n\n*This example only works on UNIX flavored system.*","x":230,"y":60,"wires":[]},{"id":"2dbf8e03.2d6a52","type":"debug","z":"a7f52169.f6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":200,"wires":[]},{"id":"d1815f06.463f3","type":"debug","z":"a7f52169.f6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":120,"wires":[]},{"id":"28467ba9.c96284","type":"comment","z":"a7f52169.f6c4","name":" spawn mode: repeat message output","info":"","x":450,"y":114,"wires":[]},{"id":"322d9b72.fc9194","type":"debug","z":"a7f52169.f6c4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":160,"wires":[]},{"id":"d5a990ce.c660b","type":"inject","z":"a7f52169.f6c4","name":"Kill process","props":[{"p":"kill","v":"","vt":"date"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":190,"y":220,"wires":[["53a714a8.1214dc"]]}]