could this be used as a complement to Constantine Samaklis script you helped me with yesterday?
Sometimes the wh1080 freezes USB-connection to my raspberry pi but the weewx service is still running so Constantines script wont have any effect in this case?
I think this issue with whxxxx is well known.
BR Mikael
--
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 weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi, Mikael,My watchdog script could certainly be "complimentary" to Constantine's script, and with minor modifications could potentially replace it. IIRC, isn't mine at least the third script recently mentioned on the alias to address nearly the same issues?For sure these scripts shouldn't be necessary, but things happen, and bugs that can be fixed may eventually be fixed, but in the mean-time, I'd rather have a script notify / remediate / workaround issues than keep randomly discovering that my station isn't reporting only hours after it "went offline." :-/So, anyway, in my weewx_watchdog script I am merely sending an e-mail notification when the station hasn't reported, but there is an example included (commented out) that initiates a reboot, which is the only remedy I have found for when my WMR300 stops communicating on my RPI.Instead of the "shutdown -r now" it would be very easy to instead use "systemctl status weewx" to check if the service is running and then "systemctl start weewx" to start it (or "systemctl restart weewx").With a little more work, I could do a series of remediation steps, like first attempting to restart weewx, then IFF the station still is not reporting, do the reboot the next time. I didn't bother, because never once ever did a simple restart of weewx fix the USB issues with my WMR300 on RPI. Also, I didn't bother to check if weewx was running, because my weewx has never actually stopped running. It's always the USB issue at fault in my case. :-/If there is interest I could add a weewx restart remediation and even put some simple toggle's at the top to control which remediation steps are desired, such as restart_weewx vs. reboot_host, and maybe even do the logic to first try one and then the other if both are enabled. Could put a toggle for whether to do the wunderfixer steps, too. I'm going to write a separate post about that in a minute. ;-)Incidentally, I had to move the script. It's in its own branch now:
https://github.com/UberEclectic/weewx/tree/watchdog/examples/watchdogRegards,Leon--Leon Shaner :: Dearborn, Michigan (iPad Pro)
Hi Leon,
could this be used as a complement to Constantine Samaklis script you helped me with yesterday?
Sometimes the wh1080 freezes USB-connection to my raspberry pi but the weewx service is still running so Constantines script wont have any effect in this case?
I think this issue with whxxxx is well known.
BR Mikael
--
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 weewx...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
Hi, Mikael,
I've added the simple toggles at the top of the script to control remediation actions.The script will always notify, but the restart weewx and reboot host actions are completely optional and controlled simply by the variables at the top of the script.If both restart weewx and reboot host actions are enabled, these become nested in that first the restart weewx will be tried one time and if after watchdogsecs the station is still not reporting, then the host reboot will occur. You can enable one or the other or both.I also added logic to check if the host was rebooted within 2x watchdog secs to avoid reboot loops. I strongly recommend not lowering the watchdogsecs below 600 (10 minutes).It's important to note that my approach isn't actually checking whether the weewx process is running, rather, the loss of communications checking is based on whether weewx has written any records to the database lately.You'll find the update over here:BTW, if you use my script don't run another kind of weewx restarter script, or they will step on each other. (Or at least be sure to disable the weewx restart toggle in mine).
Regards,Leon--Leon Shaner :: Dearborn, Michigan (iPad Pro)
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
Hey, Mikael,
Nice catch. That message about 1556807461 seconds is a left-over from the earlier version. It is not only redundant, but also incorrect, due to what amounts to re-use of an earlier variable. :S I have removed it.Your weewx.conf archive interval of 600 seconds is not really a problem, it's up to you what to put there, but in that case you probably want to increase my watchdogsecs by a factor that approximates how long it takes your system to boot and for weewx to post the first record. My RPI boots in under a minute, so if yours is similar, even watchdogsecs=660 should suffice.Hmm. Maybe longer. Please check your syslog and see if you can approximate how long after a reboot it takes before this type of message to appear from weewx:weewx[9809]: manager: Added record 2019-05-02 06:24:00 EDT (1556792640) to databaseTo your next questions...It isn't 100% clear to me which way you have the toggles set.Did you ultimately enable both remediation actions steps, before seeing the erroneous message?doweewxrestart=1dohostreboot=1Even that erroneous message shouldn't have appeared unless you have dohostreboot=1 but you are mentioning mainly that you tried the doweewxrestart=1 first. Not sure if you mean that after trying the restart option you then went on to also try the dohostreboot=1 and saw the erroneous message?Just want to be sure, because the logic is the most important thing, and I did test that extensively. =DI didn't notice the erroneous message because it only goes to syslog and I was mainly watching the more interesting log in the case of weewx_watchdog, which is at /var/log/weewx.log. Would be helpful to see that log if there are any other issues.Cheers! =D
\Leon--Leon Shaner :: Dearborn, Michigan (iPad Pro)
Regards,Leon--Leon Shaner :: Dearborn, Michigan (iPad Pro)
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
Mikael,I would say watchdogsecs=720 is more than conservative. It is just to catch a case where loss of comms happens very close to the cron execution and another cron event fires just before your first record is posted after a reboot. Even that seems unlikely because the cron interval aligns with the reboot and you should have a record within 2 mins after that. So 720 will always be fine, but even 600 should almost always be fine. I'd have to think a lot harder for a definite case where exactly 600 would cause a problem. Rare to never, most likely.As for mailx it would get pretty complicated if I had to add support for lots of different mail utilities, none of which agree on the arguments or how to pass the body.It's kinda the point of mailx, to abstract away from whatever is happening underneath.Easier for me to just to recommend:$ sudo apt-get install mailutils=DSee if that's enough for you and I can add it to the readme. =DI can put a check for it in the script, too. =DAbout the USB auto mount, I expect there is a media manager package tied to the graphical login on the RPI. If you are running without the graphical login, there may be other options. I will do some research and contact you off alias.Regards,\Leon--Leon Shaner :: Dearborn, Michigan (iPhone)
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.