Deploy from command line

Hi!

After a longer period the inputs from my pi stop reacting.
Then i move a node and click deploy all and problem solved.
Now thinking about a cron job to deploy every night to prevent problems.
Is it possible to send a deploy all command from command line?
Or is there another way to do this?

Thanks
Rogier

well a cron job to run node-red-restart or node-red-stop && node-red-start would do the job

1 Like

sounds perfect, but would love to control it from mqtt if possible.
i have around 60 pi's to control

Not sure how to troubleshoot your problem, but wouldn't it be better to fix the issue instead of giving it first aid?

...could always order a reboot from within node-RED itself.

If you wanted to order a reboot via MQTT, just replace the inject node with a MQTT in node, and possibly a Switch node to watch for the keyword for a reboot.

reboot

2 Likes

totally agree to solve the problem. But cannot find a problem.
just a simple pi input that stops working

what type of input?
My Node-RED Pi lasted 2 years before I had to reboot it due to a house move

a raspberry pi input with a switch button, is first time since 6 months

Do you mean a gpio digital input with a mechanical switch connected to it? If so connect a debug node to the input and next time it fails see if anything is shown in the debug.

Write the MQTT msg with a retain flag. Then, in your cron job, use a small Python or node.js (depending on your preference) script to listen for the topic, reset it and then restart the device.

In addition, I've shared before my own flow for restarting Node-RED and it is really easy on a Pi or other Linux device where you are using systemd to run Node-RED. The only thing you need to do is to ensure that the user id running Node-RED is able to do SUDO on the systemctrl command without requiring a password prompt (use visudo to make the change).

You could also amend that to do a full system reboot as well if needed.

Of course, as Paul says, much better to fix the issue - but sometimes that isn't possible.