# How to Restart Flows automaticaly?

**URL:** <https://discourse.nodered.org/t/how-to-restart-flows-automaticaly/71177>\
**Category:** General\
**Tags:** function-node\
**Created:** [24 November 2022 12:01 UTC](https://discourse.nodered.org/t/how-to-restart-flows-automaticaly/71177 "2022-11-24T12:01:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![strbaknxp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/strbaknxp/32/69628_2.png) [@strbaknxp](https://discourse.nodered.org/u/strbaknxp)\
**Post date:** [24 November 2022 12:01 UTC](https://discourse.nodered.org/t/how-to-restart-flows-automaticaly/71177/1 "2022-11-24T12:01:01Z")

</div>

Hi, I would like to ask, I am running the same flow on more machines (or the same machine more ports), and I would like to automatically update all running instances by actualized flow.  
It's some way how can I do that?

I need to automatically press button on the picture  
[image|445x499](https://discourse.nodered.org/uploads/short-url/7qPc7N2b1CeJTUpnAw4ogV96FWe.png)

---

<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:** [24 November 2022 13:24 UTC](https://discourse.nodered.org/t/how-to-restart-flows-automaticaly/71177/2 "2022-11-24T13:24:30Z")

</div>

You can use a tool to call the admin API /flows endpoint on each device as long as you have permission - see the docs [POST /flows : Node-RED](https://nodered.org/docs/api/admin/methods/post/flows/)

---

<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:** [24 November 2022 13:42 UTC](https://discourse.nodered.org/t/how-to-restart-flows-automaticaly/71177/3 "2022-11-24T13:42:55Z")

</div>

Looking at that method, it isn't clear to me what the request body should contain in the case of asking for a reload.

---

<div class="post-metadata">

**Author:** ![strbaknxp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/strbaknxp/32/69628_2.png) [@strbaknxp](https://discourse.nodered.org/u/strbaknxp)\
**Post date:** [24 November 2022 14:33 UTC](https://discourse.nodered.org/t/how-to-restart-flows-automaticaly/71177/5 "2022-11-24T14:33:19Z")

</div>

Lets imagine following usecase:  
you execute following commands on the same directory:

- node-red -p 1880
- node-red -p 1881

on instance running on port 1880 you do some change and when it's done you would like to apply to instance 1881 (without restarting node-red) how you can do that?

flow.json is already new because is changed by 1880 but on 1881 is loaded the old one. And I need to somehow actualize all instances. When I click on "restart flows" it do what I want, but I need to automatize it.

---

<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:** [24 November 2022 14:50 UTC](https://discourse.nodered.org/t/how-to-restart-flows-automaticaly/71177/6 "2022-11-24T14:50:10Z")

</div>

It can be done as suggested by dceejay, it just isn't clear to me exactly how to do it to perform the `reload` function described in the link.

---

<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:** [28 November 2022 20:59 UTC](https://discourse.nodered.org/t/how-to-restart-flows-automaticaly/71177/7 "2022-11-28T20:59:56Z")

</div>

@strbaknxp it appears that when using POST /flows with the reload option then an empty body is sufficient.

---

<div class="post-metadata">

**Author:** ![strbaknxp](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/strbaknxp/32/69628_2.png) [@strbaknxp](https://discourse.nodered.org/u/strbaknxp)\
**Post date:** [2 December 2022 15:10 UTC](https://discourse.nodered.org/t/how-to-restart-flows-automaticaly/71177/8 "2022-12-02T15:10:31Z")

</div>

Hello  
@dceejay and @Colin,  
Thank you for your response. 🙂  
Now I had a time to study it and it work great.  
Thanks a lot for your effort.

---

<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:** [16 December 2022 15:10 UTC](https://discourse.nodered.org/t/how-to-restart-flows-automaticaly/71177/9 "2022-12-16T15:10:37Z")

</div>

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