Enable Node-RED to run automatically at every boot and upon crashes on UBUNTU

#1

HI, I did the follow the instruction from website as follows:

sudo wget https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/nodered.service -O /lib/systemd/system/nodered.service
sudo wget https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/node-red-start -O /usr/bin/node-red-start
sudo wget https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/node-red-stop -O /usr/bin/node-red-stop
sudo chmod +x /usr/bin/node-red-st*
sudo systemctl daemon-reload

I did enable Node-Red to run automatically at every boot and upon crashes with following syntax: -

sudo systemctl enable nodered.service

I did install in C:\ directory, its doesn't help seems. Please do advice.

0 Likes

#2

What error does it crash with?

0 Likes

#3

While i reboot, its doesn't start node-red automatically.

0 Likes

#4

What does
sudo systemctl status nodered
show?
Can you give a link to the instructions you followed for the install please. Also I don't understand the reference to C: which would suggest you are using Windows.

0 Likes

#5

I did follow as per numbered. Sorry about C:\ (my main pc in window base , actually got nothing to do with C drive)

0 Likes

#6

You can see the node-red log using
sudo journalctl -f -n 25 -u nodered -o cat
If possible please copy/paste terminal output rather than screenshot. It is easier to read and comment on. You can copy from the terminal using Ctrl-Shift-C.
Also what do

node -v
npm -v

show. If that shows you are using node.js less than 4.x then that needs to be upgraded. The easiest way to install/upgrade on Ubuntu is to use the Pi install/upgrade script.

0 Likes

#7

Did you also continue reading the docs and make the necessary changes to the files ?

Changing the systemd environment - running as non-Pi user

To run as a user other than the default pi , you need to edit the nodered.service file. To edit this use sudo to edit the file /lib/systemd/system/nodered.service and change the lines as indicated by {your_user} below

0 Likes

#9

Cheers, its working. I do miss out the changing the systemd environment - running as non Pi user.

Do appreciate everyone support.

0 Likes

#10

If node-red is installed using the Pi install script (which works well for Ubuntu) then the assumption is made that the install script is run by the user that will be the node-red user. In that case there will be no need to change the systemd script.

0 Likes