Hey gang,
I was testing out a flow which would automatically reboot my RPi whenever the RAM usage was >75% and somehow I've got it stuck in a bootloop.
Can anyone suggest a way to get out of this, please?
I used an execute node with sudo reboot.
I'm guessing I'll need to pull the SD card and modify something, but I don't have another Linux machine to work on it.
Any help appreciated!
Dax.
I think I got lucky. I kept trying and caught it at exactly the right moment and was able to disable the flow in the editor. Phew!!
To avoid this happening again, I've added a 5 minute delay to the output of the node.
Out of interest, how's my way of doing this?
var now = new Date();
if((msg.topic == "Memory") && (msg.payload >= 75) && (now.getHours() >= 3) && (now.getHours() <= 9))
{
msg.payload = 1;
return msg;
}
return null;
There is nothing wrong with what you are doing. You could be a bit more verbose for readability.
const now = new Date();
const hh = now.getHours();
if (msg.topic == "Memory" && msg.payload >= 75 && hh >= 3 && hh <= 9) {
msg.payload = 1;
return msg;
}
return null;
Start node-red in safe mode node-red --safe