mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
parent
4d7ba48797
commit
fe42b69712
@ -52,6 +52,7 @@
|
|||||||
<script type="text/html" data-help-name="daemon">
|
<script type="text/html" data-help-name="daemon">
|
||||||
<p>Calls out to a long running system command. Sends <code>msg.payload</code> to stdin of the process.</p>
|
<p>Calls out to a long running system command. Sends <code>msg.payload</code> to stdin of the process.</p>
|
||||||
<p>Provides 3 outputs... stdout, stderr, and return code , from the running command.</p>
|
<p>Provides 3 outputs... stdout, stderr, and return code , from the running command.</p>
|
||||||
|
<p>Parameters can be space separated, space separated with quotes, or a javascript array. For example `aa bb` or `"cc dd"` or `["aa","bb cc""]`.</p>
|
||||||
<p>If the called program stops (i.e. a return code is produced), this node can attempt to restart the command.</p>
|
<p>If the called program stops (i.e. a return code is produced), this node can attempt to restart the command.</p>
|
||||||
<p>Setting <code>msg.kill</code> to a signal name (e.g. SIGINT, SIGHUP) will stop the process - but if the
|
<p>Setting <code>msg.kill</code> 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 <code>msg.start</code> will also re-start the process.</p>
|
restart flag is set it will then auto restart. Sending <code>msg.start</code> will also re-start the process.</p>
|
||||||
|
@ -7,7 +7,7 @@ module.exports = function(RED) {
|
|||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.cmd = n.command;
|
this.cmd = n.command;
|
||||||
//this.args = n.args.trim().split(" ") || [];
|
//this.args = n.args.trim().split(" ") || [];
|
||||||
this.args = n.args.trim().match(/("[^"]*")|[^ ]+/g);
|
this.args = n.args.trim(); //.match(/("[^"]*")|[^ ]+/g);
|
||||||
this.cr = n.cr;
|
this.cr = n.cr;
|
||||||
this.op = n.op;
|
this.op = n.op;
|
||||||
this.redo = n.redo;
|
this.redo = n.redo;
|
||||||
@ -15,6 +15,13 @@ module.exports = function(RED) {
|
|||||||
this.closer = n.closer || "SIGKILL";
|
this.closer = n.closer || "SIGKILL";
|
||||||
this.autorun = true;
|
this.autorun = true;
|
||||||
if (n.autorun === false) { this.autorun = false; }
|
if (n.autorun === false) { this.autorun = false; }
|
||||||
|
if (this.args.match(/^\[.*\]$/)) {
|
||||||
|
try { this.args = JSON.parse(this.args); }
|
||||||
|
catch(e) {
|
||||||
|
node.warn("Bad parameters - should be a JSON array or space separated")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { this.args = this.args.match(/("[^"]*")|[^ ]+/g); }
|
||||||
var node = this;
|
var node = this;
|
||||||
var lastmsg = {};
|
var lastmsg = {};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-daemon",
|
"name" : "node-red-node-daemon",
|
||||||
"version" : "0.1.3",
|
"version" : "0.2.0",
|
||||||
"description" : "A Node-RED node that runs and monitors a long running system command.",
|
"description" : "A Node-RED node that runs and monitors a long running system command.",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user