We have moved at community.getvera.com

Author Topic: Where to store local files?  (Read 1776 times)

Offline martin12345

  • Sr. Member
  • ****
  • Posts: 321
  • Karma: +48/-4
Where to store local files?
« on: March 29, 2012, 06:27:43 am »
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


Code: [Select]
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

Offline futzle

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3260
  • Karma: +192/-9
Re: Where to store local files?
« Reply #1 on: March 29, 2012, 04:58:06 pm »
/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?)
« Last Edit: March 29, 2012, 05:15:01 pm by futzle »

Offline martin12345

  • Sr. Member
  • ****
  • Posts: 321
  • Karma: +48/-4
Re: Where to store local files?
« Reply #2 on: May 07, 2012, 05:15:09 am »
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

Offline milillicuti

  • Sr. Newbie
  • *
  • Posts: 21
  • Karma: +0/-0
Re: Where to store local files?
« Reply #3 on: May 16, 2013, 06:36:23 am »
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


Code: [Select]
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

Hello guys.

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

Thx by advance...