2016-04-18 22:38:44 +02:00
|
|
|
<!DOCTYPE html>
|
2014-12-24 22:51:17 +01:00
|
|
|
|
|
|
|
<script type="text/x-red" data-template-name="daemon">
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-command"><i class="fa fa-file"></i> Command</label>
|
|
|
|
<input type="text" id="node-input-command" placeholder="command">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
2015-09-02 11:56:32 +02:00
|
|
|
<label for="node-input-args"><i class="fa fa-list"></i> Arguments</label>
|
2014-12-24 22:51:17 +01:00
|
|
|
<input type="text" id="node-input-args" placeholder="space separated arguments">
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label> </label>
|
|
|
|
<input type="checkbox" id="node-input-cr" style="display: inline-block; width: auto; vertical-align: top;">
|
2016-04-18 22:38:44 +02:00
|
|
|
<label for="node-input-cr" style="width: 70%;">Add [enter] to every message sent ?</label>
|
2014-12-24 22:51:17 +01:00
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label> </label>
|
|
|
|
<input type="checkbox" id="node-input-redo" style="display: inline-block; width: auto; vertical-align: top;">
|
|
|
|
<label for="node-input-redo" style="width: 70%;">Relaunch command on exit or error ?</label>
|
|
|
|
</div>
|
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-op"> and</label>
|
|
|
|
<select id="node-input-op" style='width:70%'>
|
2016-04-18 22:38:44 +02:00
|
|
|
<option value="buffer">leave reply as a buffer</option>
|
|
|
|
<option value="string">format reply as a string</option>
|
|
|
|
<option value="lines">output lines of text</option>
|
|
|
|
<option value="number">try to convert reply to a number</option>
|
2014-12-24 22:51:17 +01:00
|
|
|
</select>
|
|
|
|
</div>
|
2018-05-09 10:42:51 +02:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-closer"> on close</label>
|
|
|
|
<select id="node-input-closer" style='width:70%'>
|
|
|
|
<option value="SIGKILL">kill process immediately</option>
|
|
|
|
<option value="SIGTERM">try to terminate process</option>
|
|
|
|
<option value="SIGINT">try to interrupt process</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
2014-12-24 22:51:17 +01:00
|
|
|
<div class="form-row">
|
|
|
|
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
|
|
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
|
|
</div>
|
2015-09-02 11:56:32 +02:00
|
|
|
<div class="form-tips"><b>Note:</b> The command should just be the actual command.
|
|
|
|
All parameters should be passed in as arguments.</div>
|
2014-12-24 22:51:17 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/x-red" data-help-name="daemon">
|
2016-03-02 14:24:56 +01:00
|
|
|
<p>Calls out to a long running system command. Sends <code>msg.payload</code> to stdin of the process.</p>
|
2014-12-24 22:51:17 +01:00
|
|
|
<p>Provides 3 outputs... stdout, stderr, and return code , from the running command.</p>
|
|
|
|
<p>If the called program stops (i.e. a return code is produced), this node can attempt to restart the command.</p>
|
2017-05-03 18:46:10 +02:00
|
|
|
<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>
|
|
|
|
<p><b>Note:</b> Some applications will automatically buffer lines of output. It is advisable to turn off this behaviour.
|
|
|
|
For example, if running a Python app, the <code>-u</code> parameter will stop the output being buffered.</p>
|
2014-12-24 22:51:17 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
RED.nodes.registerType('daemon',{
|
|
|
|
category: 'advanced-function',
|
|
|
|
color:"darksalmon",
|
|
|
|
defaults: {
|
2018-05-09 10:42:51 +02:00
|
|
|
name: {value:""},
|
2014-12-24 22:51:17 +01:00
|
|
|
command: {value:"",required:true},
|
|
|
|
args: {value:""},
|
|
|
|
cr: {value:false},
|
|
|
|
redo: {value:true},
|
|
|
|
op: {value:"string"},
|
2018-05-09 10:42:51 +02:00
|
|
|
closer: {value:"SIGKILL"}
|
2014-12-24 22:51:17 +01:00
|
|
|
},
|
|
|
|
inputs:1,
|
|
|
|
outputs:3,
|
2017-01-29 18:46:50 +01:00
|
|
|
outputLabels: ["stdout","stderr","exit code"],
|
2014-12-24 22:51:17 +01:00
|
|
|
icon: "arrow-in.png",
|
|
|
|
align: "right",
|
|
|
|
label: function() {
|
2018-03-30 15:50:51 +02:00
|
|
|
return this.name||this.command||"daemon";
|
2014-12-24 22:51:17 +01:00
|
|
|
},
|
|
|
|
labelStyle: function() {
|
|
|
|
return this.name?"node_label_italic":"";
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|