TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: DENNIS LEE BIEBER
from: DRUCK
date: 2020-10-23 10:59:00
subject: Re: SDCard -- install her

On 22/10/2020 21:36, Dennis Lee Bieber wrote:
> On Thu, 22 Oct 2020 20:11:45 +0100 (BST), "Dave Liquorice"
>  declaimed the following:
>
>> On Thu, 22 Oct 2020 17:35:12 -0000 (UTC), Markus Robert Kessler
>> wrote:
>>
>>> I start a python script via crontab every 10 minutes which reads I2C
>>> data from a BME280 sensor. This script calculates the temperature,
>>> relative humidity and relative air pressure and sends it to a webserver.

I've been doing that for all my Pi's for over 4 years now. I've got a
BME280, lots of htu21df (temp and humidity) and a few DS18B20s (temp only).

>> Can't help think why you start the script every 10 mins instead of
>> having in a loop with a 10 minute sleep. If you want *exactly* 10
>
>  That aspect is quite logical... Using a crontab entry means if the
> script failed at some point for some reason, a fresh process will be
> started 10 minutes later (give or take OS overhead).

I use crontab for all my discrete sensor measurement scripts, which run
at 5 and 15 minute intervals.

>  While an internal loop might support more precise 10-minute intervals,
> if the script dies then nothing will be left running.

If you register your script as a service with systemd you can get it to
automatically restart after a crash.

I use looping for things which run more often than a minute, for example
my CPU temperature averaging code takes reading every second, and
produces a rolling 5 or 15 minute average, min and max values - which
are then picked up by the cron script.

>  For a remote sensor node that relays readings to another server, I do
> think I'd want as many temporary files as possible to be running in RAM
> disk, and not off the SD card.

Yes. Its a compromise though, most of the 2MB to 10MB that my Pis write
to the card every day is logging (the higher number on log rotates), so
logging to RAM would make the SD card last a lot longer. But in the
event of a crash resulting in a reboot, I wouldn't know what happened.

There is a lot of scope to turn off logging you don't need, and to set
critical logging to SD card or a remote server, and not critical stuff
to RAM. I haven't got around to sorting that out though,

---druck

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.