# Child\_process.exec \[deginner need help\]

**URL:** <https://discourse.nodered.org/t/child-process-exec-deginner-need-help/30265>\
**Category:** General\
**Created:** [17 July 2020 15:01 UTC](https://discourse.nodered.org/t/child-process-exec-deginner-need-help/30265 "2020-07-17T15:01:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [17 July 2020 15:01 UTC](https://discourse.nodered.org/t/child-process-exec-deginner-need-help/30265/1 "2020-07-17T15:01:03Z")

</div>

Hi all,  
I would like to make a button in the dashboard to execute a script. This script updates Node-Red like this:  
`bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)`

In this [previous post](https://discourse.nodered.org/t/one-button-upgrade-in-pallette/9103/9) @TotallyInformation suggests that I use an exec node which will create a shell which can execute what I want with `chil_process.exec`.

The problem is that I am completely new to programming and I do not see how to write this script.  
Can you help me ?  
Thanks  
Chris

---

<div class="post-metadata">

**Author:** ![wb666greene](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/wb666greene/32/6534_2.png) [@wb666greene](https://discourse.nodered.org/u/wb666greene)\
**Post date:** [17 July 2020 15:05 UTC](https://discourse.nodered.org/t/child-process-exec-deginner-need-help/30265/2 "2020-07-17T15:05:48Z")

</div>

Start here, there are a lot of resources on-line:

[https://linuxconfig.org/bash-scripting-tutorial-for-beginners](https://linuxconfig.org/bash-scripting-tutorial-for-beginners)

Your "environment" is not inherited when you use an exec node so you need to use the full path to the curl command. On my system its /usr/bin/curl

---

<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:** [17 July 2020 15:27 UTC](https://discourse.nodered.org/t/child-process-exec-deginner-need-help/30265/3 "2020-07-17T15:27:46Z")

</div>

Will that work, doesn't it need to be run in terminal so that you can enter the password when required. Or are your systems setup so as not to need a password for sudo?  
Even then I am not certain it will work without a terminal session.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [17 July 2020 16:21 UTC](https://discourse.nodered.org/t/child-process-exec-deginner-need-help/30265/4 "2020-07-17T16:21:27Z")

</div>

Apart from the comments from @Colin, which are relevant, why do you want to update node-red this way? The biggest problem I see is that you wouldn't see installation errors, if they occur.

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [17 July 2020 16:34 UTC](https://discourse.nodered.org/t/child-process-exec-deginner-need-help/30265/5 "2020-07-17T16:34:56Z")

</div>

the goal is to display on the Dashboard if a new version of NR is available online :

> [@\[EDIT\] Displays if a new Node-Red update is available online, and update it from the Dashboard](https://discourse.nodered.org/t/displays-if-a-new-node-red-online-update-is-available/30061):
>
> This flow will search every 7 days if there is a new online version of Node-Red on [https://nodered.org/](https://nodered.org/). If that is the case, [EDIT] : In this new version : 1. Indicates whether a new online version is available. Click on it to start the update : [image] 2. A wheel that turns to make you wait : [image] 3. When the update is complete, you can select: either an automatic restart of NR or (by default) a popup which proposes if you want to restart (or not) in addition to indicating the time ta…

and if there is one, be able to update always from the Dashboard by clicking on a button which executes the update command or script.  
Indeed, we do not see the errors but it avoids connecting to ssh and typing in the terminal to the update command.

---

<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:** [17 July 2020 16:36 UTC](https://discourse.nodered.org/t/child-process-exec-deginner-need-help/30265/6 "2020-07-17T16:36:54Z")

</div>

If it is just node-red that you want to update then you could run directly using an exec node  
`sudo npm install -g --unsafe-perm node-red`  
and then force a node-red restart or a reboot.

Edit - corrected command above.

---

<div class="post-metadata">

**Author:** ![SuperNinja](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/superninja/32/5761_2.png) [@SuperNinja](https://discourse.nodered.org/u/SuperNinja)\
**Post date:** [17 July 2020 17:26 UTC](https://discourse.nodered.org/t/child-process-exec-deginner-need-help/30265/7 "2020-07-17T17:26:15Z")

</div>

it works, it does the job thanks for the help.

---

<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:** [31 July 2020 17:26 UTC](https://discourse.nodered.org/t/child-process-exec-deginner-need-help/30265/8 "2020-07-31T17:26:21Z")

</div>

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