# How to connect two exec nodes for a second one to start after first one

**URL:** <https://discourse.nodered.org/t/how-to-connect-two-exec-nodes-for-a-second-one-to-start-after-first-one/83066>\
**Category:** General\
**Created:** [21 November 2023 15:44 UTC](https://discourse.nodered.org/t/how-to-connect-two-exec-nodes-for-a-second-one-to-start-after-first-one/83066 "2023-11-21T15:44:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Demokedes8](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/demokedes8/32/85070_2.png) [@Demokedes8](https://discourse.nodered.org/u/Demokedes8)\
**Post date:** [21 November 2023 15:44 UTC](https://discourse.nodered.org/t/how-to-connect-two-exec-nodes-for-a-second-one-to-start-after-first-one/83066/1 "2023-11-21T15:44:50Z")

</div>

Dear all,  
I have two exec nodes. I would like the second one to start after the first one finishes successfully. How to connect them? Should I just connect output of the first one with the input of the second one? If that is the case, which output of the first one should I choose, since there are three?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 November 2023 16:09 UTC](https://discourse.nodered.org/t/how-to-connect-two-exec-nodes-for-a-second-one-to-start-after-first-one/83066/2 "2023-11-21T16:09:51Z")

</div>

Welcome to the forum @Demokedes8

> [@Demokedes8](#):
>
> Should I just connect output of the first one with the input of the second one

Yes

> [@Demokedes8](#):
>
> which output of the first one should I choose

That depends on how the first exec node is configured. Have a look at the help text for the exec node, understand what each output contains, and decide which one you should use. Note that if you have selected the output "While the command is running" then there may be multiple messages coming from output 1. Also you might want to check the return code when the first one has completed in order to check that it ran successfully before running the second command.

Finally, you might like to consider using just one node running multiple commands in series. For example, on a Linux system you can use  
`cd /some/path && command1 && command2`  
or you could write a shell script to execute the commands and run that.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [21 November 2023 17:05 UTC](https://discourse.nodered.org/t/how-to-connect-two-exec-nodes-for-a-second-one-to-start-after-first-one/83066/3 "2023-11-21T17:05:03Z")

</div>

Out of curiosity, what are the commands doing that need them to be ran after one another?

---

<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:** [20 January 2024 17:05 UTC](https://discourse.nodered.org/t/how-to-connect-two-exec-nodes-for-a-second-one-to-start-after-first-one/83066/4 "2024-01-20T17:05:21Z")

</div>

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