# Exec node with dashboard switch?

**URL:** <https://discourse.nodered.org/t/exec-node-with-dashboard-switch/40427>\
**Category:** General\
**Created:** [5 February 2021 08:24 UTC](https://discourse.nodered.org/t/exec-node-with-dashboard-switch/40427 "2021-02-05T08:24:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Summer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/summer/32/36552_2.png) [@Summer](https://discourse.nodered.org/u/Summer)\
**Post date:** [5 February 2021 08:24 UTC](https://discourse.nodered.org/t/exec-node-with-dashboard-switch/40427/1 "2021-02-05T08:24:24Z")

</div>

Hi,

I want to use a dashboard ui\_switch as this:

- on : start the exec node
- off: stop the exec node

I've tried those settings but everytime the OFF state is triggered it start a new process leaving current running:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/0/d09b86ac3f1d4a7535d534222ef85b03aea1870d.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/7/c742faeb9cfdb5ad8d199c8f810aebf9de427f60.png)

Is there a way to manage this directly or should I've add a function node that manage the behavior i.e. if input from switch is true, then do nothing if already running?

Thank you

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [5 February 2021 08:46 UTC](https://discourse.nodered.org/t/exec-node-with-dashboard-switch/40427/2 "2021-02-05T08:46:47Z")

</div>

If you check the sidebar info for the exec node you will see it need msg.kill to kill / stop it - not a msg.payload - so you need a split node (to separate on and off) and the a change node in the off leg to set msg.kill to SIGTEM.

---

<div class="post-metadata">

**Author:** ![Summer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/summer/32/36552_2.png) [@Summer](https://discourse.nodered.org/u/Summer)\
**Post date:** [5 February 2021 08:49 UTC](https://discourse.nodered.org/t/exec-node-with-dashboard-switch/40427/3 "2021-02-05T08:49:55Z")

</div>

Thank for reply, I've found a simple solution: set the switch value to string and set here the commands, leaving the exec node empty.

---

<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:** [19 February 2021 08:50 UTC](https://discourse.nodered.org/t/exec-node-with-dashboard-switch/40427/4 "2021-02-19T08:50:01Z")

</div>

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