# Stop an exec node using button

**URL:** <https://discourse.nodered.org/t/stop-an-exec-node-using-button/67191>\
**Category:** Dashboard\
**Created:** [31 August 2022 17:33 UTC](https://discourse.nodered.org/t/stop-an-exec-node-using-button/67191 "2022-08-31T17:33:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yimin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yimin/32/62608_2.png) [@yimin](https://discourse.nodered.org/u/yimin)\
**Post date:** [31 August 2022 17:33 UTC](https://discourse.nodered.org/t/stop-an-exec-node-using-button/67191/1 "2022-08-31T17:33:43Z")

</div>

Hi,  
I'm new to Node-RED. I'm trying to start and stop an exec node using buttons in dashboard.  
But I think it is not a simpler way to kill the exec node. Is there any methods not using the function node in my flow?

```auto
[
    {
        "id": "2da5e0579eb45ef8",
        "type": "tab",
        "label": "Test",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "30afcce0c0d75c87",
        "type": "debug",
        "z": "2da5e0579eb45ef8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 140,
        "wires": []
    },
    {
        "id": "ef21a8ddbbe44831",
        "type": "ui_button",
        "z": "2da5e0579eb45ef8",
        "name": "",
        "group": "62032b85c8602ef4",
        "order": 0,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "start",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 70,
        "y": 140,
        "wires": [
            [
                "2732a810ed7702c9"
            ]
        ]
    },
    {
        "id": "a44057a1c3f00f5b",
        "type": "ui_button",
        "z": "2da5e0579eb45ef8",
        "name": "",
        "group": "62032b85c8602ef4",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "label": "kill",
        "tooltip": "",
        "color": "",
        "bgcolor": "",
        "className": "",
        "icon": "",
        "payload": "",
        "payloadType": "str",
        "topic": "topic",
        "topicType": "msg",
        "x": 70,
        "y": 200,
        "wires": [
            [
                "5556756c1e738fad"
            ]
        ]
    },
    {
        "id": "2732a810ed7702c9",
        "type": "exec",
        "z": "2da5e0579eb45ef8",
        "command": "ping 192.168.107.153",
        "addpay": "",
        "append": "",
        "useSpawn": "true",
        "timer": "",
        "winHide": false,
        "oldrc": false,
        "name": "",
        "x": 420,
        "y": 140,
        "wires": [
            [
                "3d303f7edb13bc72"
            ],
            [
                "30afcce0c0d75c87"
            ],
            [
                "af012a97515577de"
            ]
        ]
    },
    {
        "id": "5556756c1e738fad",
        "type": "function",
        "z": "2da5e0579eb45ef8",
        "name": "",
        "func": "\nmsg.kill = \"sigint\"\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 200,
        "y": 200,
        "wires": [
            [
                "2732a810ed7702c9"
            ]
        ]
    },
    {
        "id": "3d303f7edb13bc72",
        "type": "ui_text",
        "z": "2da5e0579eb45ef8",
        "group": "62032b85c8602ef4",
        "order": 2,
        "width": 0,
        "height": 0,
        "name": "",
        "label": "text",
        "format": "{{msg.payload}}",
        "layout": "col-center",
        "className": "",
        "x": 650,
        "y": 100,
        "wires": []
    },
    {
        "id": "af012a97515577de",
        "type": "debug",
        "z": "2da5e0579eb45ef8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 180,
        "wires": []
    },
    {
        "id": "62032b85c8602ef4",
        "type": "ui_group",
        "name": "Test",
        "tab": "c80db3bbe3798556",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "c80db3bbe3798556",
        "type": "ui_tab",
        "name": "Home",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

And on dashboard, how can I arrange the start button on top of other objects?  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/d/ed5b98b8afc3972a08a19f43fe9044049c4e122b.png)

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [31 August 2022 18:35 UTC](https://discourse.nodered.org/t/stop-an-exec-node-using-button/67191/2 "2022-08-31T18:35:59Z")

</div>

> [@yimin](#):
>
> I'm trying to start and stop an exec node using buttons in dashboard.  
> But I think it is not a simpler way to kill the exec node.

Hi @yimin.

Is ping just an example or is that actually what you are calling from exec?

Because you could call **ping -c 2 192.168.107.153** and it will automatically exit after 2 pings.

> [@yimin](#):
>
> Is there any methods not using the function node in my flow?

You can set msg.kill with a Change node instead of a Function

> [@yimin](#):
>
> And on dashboard, how can I arrange the start button on top of other objects?

From the drop-down just below the hamburger menu choose "Dashboard"  
 ![Untitled 7](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/a/3ad0aa95102f098a8db73e78e97daa6226261fe5.jpeg)  
Find the dashboard tab & choose "layout"  
 ![Untitled 8](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/425ca86f0619f43d795d68082293e283a475ddbd.jpeg)  
This no-frills wysiwyg layout editor lets you drag the widgets around.

 ![Untitled 9](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/2/825f9a894d077c4b1ec7c43c3e79da58caffea58.jpeg)

---

<div class="post-metadata">

**Author:** ![yimin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yimin/32/62608_2.png) [@yimin](https://discourse.nodered.org/u/yimin)\
**Post date:** [1 September 2022 13:29 UTC](https://discourse.nodered.org/t/stop-an-exec-node-using-button/67191/3 "2022-09-01T13:29:23Z")

</div>

Hi,  
Thanks for your help.  
The ping is just an example.  
The layout is really helpful. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 September 2022 13:30 UTC](https://discourse.nodered.org/t/stop-an-exec-node-using-button/67191/4 "2022-09-15T13:30:19Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
