I want that if my node-red stops for some reason that it can be restarted by itself. I was thinking in using a python script with "os.system()" and then using "crontab -e" to init it in the start of the device.
I am using a Raspberry Pi 3.
If you can attach me some code or instructions I would really appreciate it.
If you start node-red using the systemd method (systemctl, etc.) then you can use that to restart it on certain conditions. This would be the “correct” way to do it as well. You just need to edit the service file. I’ll let you Google on howto.
You should have followed these instructions for a pi. https://nodered.org/docs/hardware/raspberrypi
You can run the upgrade script there to bring everything up to date. If you follow those instructions including the section on running from boot then yes, it will restart if node red crashes