Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.raspberry-pi > #25953
| From | Pancho <Pancho.Dontmaileme@outlook.com> |
|---|---|
| Newsgroups | comp.sys.raspberry-pi |
| Subject | Re: Battery Powered Project |
| Date | 2021-01-18 13:20 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <ru41vs$tdp$1@dont-email.me> (permalink) |
| References | (7 earlier) <rtvpka$3kh$3@dont-email.me> <rtvsuq$dbf$1@dont-email.me> <rtvu73$pb$1@dont-email.me> <ru1454$f7c$1@dont-email.me> <ru1hpk$qub$1@dont-email.me> |
On 17/01/2021 14:32, Martin Gregorie wrote:
> On Sun, 17 Jan 2021 10:39:32 +0000, Pancho wrote:
>
>> However, I'm not yet convinced this is a sensible way of observing
>> events. I'm still undecided.
>>
> That depends: if the occurrence of events to be observed cause messages
> to be logged rather than being dealt with by the program that observes
> them, then watching a log for the occurrence might well be the best way
> to do it since this separates the observation from the consequent action,
> offering the possibility of more than one observing process being able to
> trigger the action. Where that action is irreversable, as it is in this
> case, that sounds like a good idea.
>
> Of course, if the observer doesn't log anything, there's no reason to use
> a general purpose logfile - just write the observations to a file or
> pipeline that's accessable to the process that will execute the action:
> as this is Linux, you can use shared memory or a semaphore (if the
> programming language supports it) to signal that an actionable event has
> occurred. Shared memory, event queues and asynchronous i/o are all
> available in the C and Java standard function/class libraries but may not
> be in other languages.
>
> OTOH if the required action is specific to the observer, i.e. doesn't
> affect anything outside the process(es) handling the data stream being
> observed, then simply deal with the observation inside the observing
> process.
>
>
Yeah, I'm not sure what you mean, the journal/logfile is the "subject",
the "observer" logging isn't relevant.
FWIW I got this basic pattern to work.
--
journalctl -f | awk -W interactive -- '/Specific Event/ { system(
"/home/pi/SpecificEventHandler.sh") }'
--
Response appears to be ballpark of 30ms on a rPi3. Tested with:
date +%S-%N;logger "Specific Event"
And /home/pi/SpecificEventHandler.sh
--
#!/bin/bash
touch "awktest$(date +%H-%M-%S-%N)"
-
I'm not sure what awk interactive/buffering means. Without the "-W
interactive" flag awk doesn't just buffer output, the system() call is
delayed too. It's more like it is buffering input.
Back to comp.sys.raspberry-pi | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Battery Powered Project Simple Simon <please.dontspa@me.com> - 2021-01-12 12:14 +0000
Re: Battery Powered Project Chris Green <cl@isbd.net> - 2021-01-12 12:40 +0000
Re: Battery Powered Project Simple Simon <please.dontspa@me.com> - 2021-01-12 12:50 +0000
Re: Battery Powered Project "A. Dumas" <alexandre@dumas.fr.invalid> - 2021-01-12 15:15 +0100
Re: Battery Powered Project Theo <theom+news@chiark.greenend.org.uk> - 2021-01-12 21:43 +0000
Re: Battery Powered Project Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2021-01-13 09:40 +0000
Re: Battery Powered Project Jim H <invalid@invalid.invalid> - 2021-01-13 18:02 +0000
Re: Battery Powered Project Joe <joe@jretrading.com> - 2021-01-13 22:04 +0000
Re: Battery Powered Project Theo <theom+news@chiark.greenend.org.uk> - 2021-01-13 23:37 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-14 00:43 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 03:59 +0000
Re: Battery Powered Project Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-14 10:18 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 11:04 +0000
Re: Battery Powered Project Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-14 11:46 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 12:21 +0000
Re: Battery Powered Project Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-14 12:38 +0000
Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-14 14:17 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 14:28 +0000
Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-16 20:09 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-17 07:19 +0000
Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-17 15:57 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-18 07:05 +0000
Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-18 14:14 +0000
Re: Battery Powered Project John Aldridge <jpsa@cantab.net> - 2021-01-17 17:52 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-14 12:56 +0000
Re: Battery Powered Project Theo <theom+news@chiark.greenend.org.uk> - 2021-01-14 13:46 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 14:26 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 03:46 +0000
Re: Battery Powered Project Folderol <general@musically.me.uk> - 2021-01-14 09:23 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 11:04 +0000
Re: Battery Powered Project Folderol <general@musically.me.uk> - 2021-01-14 17:48 +0000
Re: Battery Powered Project Jim H <invalid@invalid.invalid> - 2021-01-18 17:07 +0000
Re: Battery Powered Project Joe <joe@jretrading.com> - 2021-01-18 20:33 +0000
Re: Battery Powered Project Jim H <invalid@invalid.invalid> - 2021-01-21 20:36 +0000
Battery Powered Project nospam.Vincent.Coen@f1.n250.z2.binkp.net (Vincent Coen) - 2021-01-12 14:35 +1300
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-12 16:40 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-13 13:56 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-13 15:12 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-16 12:24 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-16 17:53 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-16 20:39 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-16 22:33 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-16 23:30 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-16 23:52 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-17 10:39 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-17 14:32 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-18 13:20 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-18 13:41 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-18 14:02 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-18 15:15 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-19 13:46 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-19 15:24 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-19 15:34 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-19 16:21 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-19 17:18 +0000
Re: Battery Powered Project Richard Kettlewell <invalid@invalid.invalid> - 2021-01-19 19:31 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-20 10:12 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-19 22:15 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-20 10:03 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 10:49 +0000
Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-20 11:29 +0000
Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 12:18 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 13:02 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-20 15:49 +0000
Re: Battery Powered Project Richard Kettlewell <invalid@invalid.invalid> - 2021-01-20 16:54 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 17:19 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-21 10:24 +0000
Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 12:18 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 13:18 +0000
Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-20 14:14 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 14:51 +0000
Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 14:45 +0000
Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 14:44 +0000
Re: Battery Powered Project Richard Kettlewell <invalid@invalid.invalid> - 2021-01-20 15:07 +0000
Re: Battery Powered Project "A. Dumas" <alexandre@dumas.fr.invalid> - 2021-01-20 16:38 +0100
Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-20 15:45 +0000
Re: Battery Powered Project druck <news@druck.org.uk> - 2021-01-21 10:07 +0000
Re: Battery Powered Project "A. Dumas" <alexandre@dumas.fr.invalid> - 2021-01-21 12:30 +0100
Re: Battery Powered Project druck <news@druck.org.uk> - 2021-01-21 13:09 +0000
Re: Battery Powered Project Anssi Saari <as@sci.fi> - 2021-01-22 10:08 +0200
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-22 10:29 +0000
Re: Battery Powered Project Chris Green <cl@isbd.net> - 2021-01-22 10:25 +0000
Re: Battery Powered Project Kees Nuyt <k.nuyt@nospam.demon.nl> - 2021-01-19 17:03 +0100
Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-17 01:09 +0000
Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-17 11:48 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-17 12:11 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-17 14:43 +0000
Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-17 11:52 +0000
Re: Battery Powered Project Andy Burns <usenet@andyburns.uk> - 2021-01-17 13:53 +0000
csiph-web