Im learning Node Red with a fairly basic project that displays 7 sets of data in 4 graphs running on a headless pi-0w.
Using a named persistent data store (json file) for each chart, set to 'flush its buffer' (write to the file) every hour to minimise sd writes.
the buffer should generally contain less than 10 new data points in an hour. though during development/testing episods that could increase by a factor of 10..
all 4 files live in the home dir of the pi user, one file repeatedly empties/gets deleted? unexpectedly losing all the data?
on the original pi-zero this started happening on i tried to get vnc server up for a gui access, in doing so i messed up the system such that it failed to boot (dodgy sd card??) - anyway i moved development onto a new pi-0w with a freshly installed full version upto date of stretch and installed only my key tools onto its brand new 16gb sandisk ultra micro sd card bought from sandisk via amazon.
And I am again loosing the contents of the same file after unexpected power offs.. with the file being written to once an hour i am finding it difficult to comprehend that my pi always gets a hard reset when that file is accessed.. While not ideal the pi-0 is powered via a network AP's usb port and the AP gets a reboot every now and again when its signal is weak
The file name is PlantEC1.json in the pi user home dir. I have renamed the file once already.
meanwhile the data stores for the other 3 charts have survived intact on both pi's that have hosted this system under development.
any ideas as to WTF? or how to counter the problem, a cron job to copy the file to a backup location every hour If its larger then the one already backed up?
Thanks in advance