Looking for a Weewx running script

262 views
Skip to first unread message

Mike

unread,
May 24, 2018, 2:42:18 AM5/24/18
to weewx-user
Hi guys,

my Weewx is crashing time by time.

I am looking for a script which is checking the status of Weewx every hour. In case Weewx was crashing the script is starting Weewx.

My Linux knowledge is not the best at all. Looking like something: It does not work.

#!/bin/bash
#weewx check
if ps x | grep -v grep | grep -v checkweewx.sh | grep -c weewx >/dev/null
then
echo "weewx .... ok"
else
echo ""
date >> /etc/weewx/weewx.fail
echo "weewx crashed ... restarting now" >> /usr/local/
sleep 1
/etc/init.d/weewx start
fi

Thanks

Andrew Milner

unread,
May 24, 2018, 3:56:07 AM5/24/18
to weewx-user
Weewx does not crash without a reason.  Believe me - it doesn't.

What does the log have to say around the time of the crashes.  Fixing the cause of your crashes is the right way to go about fixing the problem rather than trying a sticky plaster approach with automated restarts.  Automated restarts are just the wrong way to go about this - believe me.

Can you tell us your station type, install method and attach a log and/or config file and say what skin(s) or extensions you are using.

Then we can help you sort out your problems.

If you are using a raspberry pi have you also checked the weewx wiki for advice on using weewx with a raspberry pi

Mohamed Al Futtan

unread,
May 24, 2018, 4:35:17 AM5/24/18
to weewx...@googlegroups.com
Thanks for your quick response. I have no fixed IP from my ISP, my DynDNS IP is checked and updated every 5 minutes

I am running a Davice Vantage Pro with WeatherLink IP

As attached file the log and my conf file

Thanks again

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/c3NEhifi_Ro/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

weewx.conf
weewy.log

Andrew Milner

unread,
May 24, 2018, 4:54:34 AM5/24/18
to weewx-user
since you seem to be using a non-static ip connection which may not be known for 5 minutes (30 secs) to the weather station have you tried increasing the wait time to say 6 minutes (360 secs) in weewx.conf (currently set to 180 secs).  I'm sure this is a question of tweeking the timeouts and retries to make weewx cater for the fact that the ip address of the station has altered.

Of course, if you can give the station and host addresses on an internal network things would improve - but you don't give the hardware / network setup.

I'm sure many people are running watchdog scripts of some kind though.  Your issue does not appear to be a crash from the log segment you posted however - since weewx is definitely still trying to establish contact with the station - so weewx is doing the right things.

Another VP user will know the answer to this - but it seems to me that from a theoretical viewpoint it would be better in your situation to have no loop records, hardware created archive records, and only poll the station once every archive interval to retrieve the latest rec - and ignore loop data.  This would have the effect of minimising the comms with the station ….but I do not know if this is possible or not.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.

Mohamed Al Futtan

unread,
May 24, 2018, 5:15:09 AM5/24/18
to weewx...@googlegroups.com
Dear Andrew,

my Weewx is not running at this point, see the log file

Right now it is running, If I try to start it I am getting:

* Starting weewx weather system weewx
 *  already running...
   ...done.
which is right.

But before it was not running and it was crahing. I am pretty sure the Dedicated server with my Domain is getting the right IP.
Any way, I have changed the wait time as you have suggested to 360 and restarted Weewx.

Pls have a look again into my log file, I have seen 100 times the entry with the same date/time stamp. I think it is not normal too.

May 24 00:19:11 sd-69780 weewx[1752]: vantage: Retry #16 failed
May 24 00:19:11 sd-69780 weewx[1752]: vantage: ip-write error: [Errno 32] Broken pipe


To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.

Andrew Milner

unread,
May 24, 2018, 5:46:06 AM5/24/18
to weewx-user
I am sorry - this is NOT a crash.  Weewx is sill running and is trying and trying to reach your station.

If you look closely at your log you will see it is logging try #1, try #2, try #3, try #4 and so forth.  This is not a crash - this is handling an error because it cannot communicate with the station.  Presumably your redirection is not yet up-to-date, so weewx cannot communicate with the station and must keep retrying.  There is nothi9ng else weewx can do until the connection is re-established via your redirection.

Weewx is still running and trying to communicate with the station.  Why do you say it has crashed??  

Mohamed Al Futtan

unread,
May 24, 2018, 5:58:00 AM5/24/18
to weewx...@googlegroups.com
Hi Andrew,

in case it would be run I should get this message when I try to start it: "already running"

/etc/init.d/weewx start
* Starting weewx weather system weewx
 *  already running...
   ...done.

What I am calling a crash and I run
/etc/init.d/weewx start
I am getting, see below, so Weewx is not running and after the website is getting
updates from the station
* Starting weewx weather system weewx
   ...done.





To unsubscribe from this group and all its topics, send an email to weewx-user+unsubscribe@googlegroups.com.

Andrew Milner

unread,
May 24, 2018, 6:01:46 AM5/24/18
to weewx-user
then that is when we need the log.  the log you posted weewx was still running.

I guess eventually weewx probably hits the wait for x minutes before restarting situation - maybe that is what is happening - but weewx would log a message before shutting down.

I do not believe the log you posted was from a time when weewx was stopped.  Next time it appears stopped can you post the log so we can see how and why it shut down.

Andrew Milner

unread,
May 24, 2018, 6:24:07 AM5/24/18
to weewx-user
I'm still a little lost as to why your weather station is talking to weewx via the internet - can't you just give weewx an internal IP address for the weather station and not bother using dyndns.

Just seen that this was discussed a year or so ago also - so will let the vp experts take over from here - looks as though other setting tweeks may be required for the ip logger.

Paul Bartholdi

unread,
May 24, 2018, 8:27:39 AM5/24/18
to weewx-user
Hello,

Having you station on Internet could be an other root of yourr problem: hackers interfering/disrupting your connections. Most stations I know have little, if any, protection against hackers. So check your firewall. You can also install a spy, using wireshark for example, recording all in/out coming data to your weather station.

Good luck!     Paul

Mike

unread,
May 31, 2018, 4:46:57 AM5/31/18
to weewx-user
Hi guys,

since my last post weewx is down again.

- I did a ping from my weewx server to my DynDnsDomain to be sure the Weewx server has the right WAN IP from my weather station. I can confirm the IP address is right
- My WeatherLink IP has a static IP in my local network and even the port forwarding is right

After I started Weewx the website is updated.

I have attached 2 log files. One file is after weeex stopped and the other one after I have restarted Weewx.

Thanks
weewx_after_restart.log
weewx_after_stop.log

Andrew Milner

unread,
May 31, 2018, 6:10:37 AM5/31/18
to weewx-user
Did you try increasing the wait-before-retry and other times in weewx.conf?

From the logs it looks as though weewx goes into a restart mode, but in trying the restart there is still no connection for loading the driver - so at that point it just gives up, since it cannot even start.

Mike

unread,
May 31, 2018, 7:03:54 AM5/31/18
to weewx-user
 I have change it to

wait_before_retry = 600



# TCP send delay (when using the WeatherLinkIP):
tcp_send_delay = 0.5
   
    # The id of your ISS station (usually 1). If you use a wind meter connected
    # to a anemometer transmitter kit, use its id
    iss_id = 1
   
    # How long to wait for a response from the station before giving up (in
    # seconds; must be greater than 2)
timeout = 120
   
    # How long to wait before trying again (in seconds)
wait_before_retry = 360

loop_on_init = True
   
    # How many times to try before giving up:
    max_tries = 20


Andrew Milner

unread,
May 31, 2018, 7:22:18 AM5/31/18
to weewx-user
put 

loop_on_init = 1 

under the debug setting at the start of weewx.conf so weewx will continue to try and load the driver on startup

Andrew Milner

unread,
May 31, 2018, 7:24:39 AM5/31/18
to weewx-user

Mike

unread,
May 31, 2018, 7:53:33 AM5/31/18
to weewx-user
Thanks mate. I have changed it and restarted Weewx

I will let you know.

Thanks again.


Reply all
Reply to author
Forward
0 new messages