On 12/01/2021 16:40, Pancho wrote:
> On 12/01/2021 12:14, Simple Simon wrote:
>> I am working on a battery powered car and want the Pi to shut down
>> automatically if the battery starts to go flat to try to prevent SD
>> card corruption. I am a beginner to bash scripts! I will run this via
>> crontab...
>>
>> #!/bin/bash
>> powerstatus=$(vcgencmd get_throttled)
>> if [ $powerstatus="throttled=0x1" ]
>> then
>> echo Under Voltage Detected - Shutting Down
>> sudo halt
>> else
>> echo Voltage Normal
>> fi
>>
>> Obviously it is not working!! Could someone correct and explain for me
>> please.
>
> Not being much help, but...
>
> I'm aware of Under Voltage problems from entries in journalctl. It seems
> to me that listening for events logged to journalctl would be a pretty
> common thing to do. So common that there should be some standard way of
> doing it. Some kind of standard Observer pattern on jounalctl. Does
> anyone know of one?
Well that's just another problem with systemd. When coming up with
something similar in Apache, I could tell apache to log to a process
that tripped certain (security relevant) events.
There ought to be a way to tell systemd to do similar so you can have a
watchdog attached...but who knows how to do it?
--
“Puritanism: The haunting fear that someone, somewhere, may be happy.”
H.L. Mencken, A Mencken Chrestomathy
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|