Run raspberry update script from nodered

hi, is possible to launch the update script for raspberry (
bash <(curl -sL
directly from raspberry nodered?
thanks for the answer

Yes. You can use the exec node for that. Of course, you will need to make sure that the script doesn't prompt for a response because if it does, it will fail. You would also need to restart Node-RED afterwards assuming anything important was updated.

However, there are also other ways to keep things updated. Once you've run the script to get everything installed, you should be able to use the standard apt and npm tools to do updates.

Are you sure?
The script will stop node-RED, wouldn't that also stop the bash script session from running.

1 Like

No, not totally sure, I've not tried it :grin: But as long as exec is creating its own shell, I think it will. Easy enough to test.

Personally, I don't use the script and certainly wouldn't use it to update my environment, especially from within Node-RED. I prefer to set up and use native commands to keep things simple.

1 Like

If you just want to update node-red then you could use an exec node to run
sudo npm install -g --unsafe-perm node-red
then another to restart node-red. You would need to set the system up to not require a password for that command.
That will be another problem trying to run the bash script, it will ask for a password at some point.

You can, of course, set your sudo settings to allow specific (or even all) sudo commands to be run without an additional password which is useful for the exec node - though worth thinking about the security risks.

Once you have apt sources configured for node.js, mosquitto, etc, just running sudo apt update && sudo apt upgrade will update everything. Though investigate the apt command switches if you want to ensure that you don't get any requests for interactions.

Except node red, which has to be done via thenpm command.

thanks for yours response but my problem is that when i launch the script from the exec node of nodered the script start but before update nodered the script will kill noderd and also the script will be killed so the result is not the update of node red but only the stop of nodered. i try to use nohup before the command but not work. any other solution?

You need to launch the script in its own shell so that when Node-RED ends, the sub-shell continues.

there is a way to do this from inside node-red?

Yes. Exec just creates a sub-shell but instead of calling the command directly, you should call sh or bash with the command as a parameter. I can't quite remember whether you need to push it to the background to allow the exec to finish, you may need to experiment a bit.

You may wish to do a bit of reading about Linux shells and how they interact with the OS.

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