On 23/06/2019 09:03, Dave, G1OGY wrote: > > > On Sunday, 9 June 2019 13:33:54 UTC+1, Nick wrote: >> >> On 09/06/2019 05:51, 'Johannes Ebner' via weewx-user wrote: >>> I still have this issue. For me it seems that the Power-Cycle >>> Implementation in WeeWx is broken. >>> >> >> Hi, >> >> I am in the same boat :-( >> >> >> Likewise. > > I have just implemented a couple of scripts to use `uhubctrl` (which does > control the RPi's USB port): > > #!/bin/bash > # monitorlockup > # watch the weewx log file for lockup condition and use USB power > recycling to clear the lockup > # 20190622 > > LOGfile="<path-to>/weewx.log" > tail -Fn0 $LOGfile | > while read line ; do > echo "$line" | grep -q "Errno 110" > if [ $? = 0 ] > then > /home/weewx/powercycleusb > fi > done > > And > > #!/bin/bash > # powercycleusb > > <path-to>/uhubctl -a off -p2 > sleep 45 > <path-to>/uhubctl -a on -p2 > > Both scripts are executable, owned by root and also setuid root. > `monitorlockup` will run from /etc/rc.local on boot (I trust). > > Note: The -F (CAPS) in `tail` should track the logfile despite any log > rotation. > > It is possible that the 45 second `sleep` could be reduced. > My logs show approx 2 minutes between the first (of 4) prints of [`Errno > 110]` > so I hope to have the console restarted and stable before `weewx` resets > itself. > > Does it work? Time will tell... > Dave,
Very many thanks The bit of the puzzle (& confess I'd not looked hard) was how tp parse the log file - easily (& not read ALL of it each time and keep count or numbers of errors etc. etc. etc.) Now in place on my system (not a Pi) and not yet rebooted as it is also the system for WxSat images (EuMetCast MSG) Thanks again Nick (who really ought to read 'man $CMD' more often) p.s. I see the cookie monster is reading my emails again :-) -- "But you read a lot of books, I'm thinking. Hard to have faith, ain't it, when you've read too many books?" (Carpe Jugulum) 10:15:02 up 8 days, 13 min, 8 users, load average: 0.83, 0.93, 0.91 -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/4f43285d-565e-b284-9dc6-2ecb92324bd0%40dctower.co.uk. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
