Where to store local files?

I have written a custom interface for heatmiser thermostats, and now I want to record those temperatures. I can write to a file no problem as follows

local file = io.open("/tmp/log/mjm/temperatures.log","a") ... file:write(os.date('%x %X ')..string.sub(temp_string,0,78)..'\n') file:close()

but what I find is that the file and directory gets deleted periodically. The same applies if I use /tmp/log/cmh. Ideally I want to write to the USB drive rather than internal memory, but how can I do that without the file getting deleted (my own code takes care of limiting file sizes, so that is not a concern).

Thanks

Martin

/tmp gets wiped on a reboot. Have you tried writing to some other place (such as /usr)?

Edit: not /var, which is a symlink to /tmp (wtf?)

Thanks futzle. I was a bit concerned about storing it not on the USB because of running out of space, but I tried it and it seems to work well. Thanks for that.

Martin

[quote=“martin12345, post:1, topic:171069”]I have written a custom interface for heatmiser thermostats, and now I want to record those temperatures. I can write to a file no problem as follows

local file = io.open("/tmp/log/mjm/temperatures.log","a") ... file:write(os.date('%x %X ')..string.sub(temp_string,0,78)..'\n') file:close()

but what I find is that the file and directory gets deleted periodically. The same applies if I use /tmp/log/cmh. Ideally I want to write to the USB drive rather than internal memory, but how can I do that without the file getting deleted (my own code takes care of limiting file sizes, so that is not a concern).

Thanks

Martin[/quote]

Hello guys.

Would it be possible to have the entire lines to write a file in a specific folder?

Thx by advance…