I wish to trigger a restart of node red when I use this url on the node-red server, which is a rasp pi.
http://192.168.1.120:1880/node-red-restart
On the rasp pi, the node-red restart command is
cd /home/pi/.node-red; node-red restart
How do I get node-red to restart using a url in this way?
I have a "http in" node and an "execure node" with the flow as configured below.
[
{
"id": "b614769e.cfcf98",
"type": "exec",
"z": "5e66f20c.58838c",
"command": "cd /home/pi/.node-red; sudo node-red restart",
"addpay": false,
"append": "",
"useSpawn": "false",
"timer": "",
"oldrc": false,
"name": "node-red restart",
"x": 660,
"y": 420,
"wires": [
[],
[
"13381a54.0c6cc6"
],
[]
]
},
{
"id": "38a70270.e1cfce",
"type": "inject",
"z": "5e66f20c.58838c",
"name": "node-red restart",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "node-red restart",
"payloadType": "str",
"x": 160,
"y": 420,
"wires": [
[
"b614769e.cfcf98"
]
]
},
{
"id": "87c92674.4d5518",
"type": "http in",
"z": "5e66f20c.58838c",
"name": "node-red restart",
"url": "http://192.168.1.120:1880/node-red-restart",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 160,
"y": 480,
"wires": [
[
"b614769e.cfcf98"
]
]
},
{
"id": "13381a54.0c6cc6",
"type": "debug",
"z": "5e66f20c.58838c",
"name": "node-red restart",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 900,
"y": 420,
"wires": []
}
]