WEEWX auto restart on Rasp PI

496 views
Skip to first unread message

Mark Burfeind

unread,
Jul 20, 2015, 11:46:36 AM7/20/15
to weewx...@googlegroups.com
running WEEWX on RASP PI weather station is Davis VantageVue with Weatherlink IP feeding data to WEEWX on my PI and updating Weatherunderground using Rapid Fire 

occasionally while the Pi keeps running WEEWX occasionally crashes and instead of WeeWX feeding WU using rapid fire it reverts back to feeding WU using the Davis connection og 15 minute updates to WU

my question is there any way to have some code running on the Pi that checks to see if WeeWX has crashed and restart it if it has  

Thomas Keffer

unread,
Jul 20, 2015, 11:53:36 AM7/20/15
to weewx-user
A better idea is to figure out why weewx is crashing. If it is crashing, then there is a design flaw and it should be engineered out. 

Weewx can be extremely stable: I have an installation that has been up for 225 days and counting.

Set debug=1, restart weewx, then forward the log after a crash.

-tk

--
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.

Jarmo Seppänen

unread,
Jul 20, 2015, 1:04:12 PM7/20/15
to weewx...@googlegroups.com
Hi,

I agree with Tom....but if you still want to do it 😉 I stumbled upon this little software called monit which should do everything you need.

It can also monitor db and other really important sw on the pi e.g. ssh, ntp, dhclient, apache etc.

More information from https://mmonit.com/monit/

You can find it as a deb package from debian packages so no need to compile it separately.

jaMO

Kjell Thomas Pedersen

unread,
Jul 21, 2015, 5:48:11 AM7/21/15
to weewx...@googlegroups.com

Always best to find the cause, but I find it's nice to have a process anyway that monitors the weewx process (just in case).

I run a basic bash script:

#!/bin/bash

if [ ! $(pgrep weewx) ]
then
   echo "Weewx is not running."
   sudo service weewx start
else
   echo "Weewx is running."
fi

Which I call in a cron job every 10 minutes (crontab -e)

ie: 
0 10 * * * /home/weewx/chkwx.sh

So, this just checks the actual process, nothing else. (pgrep returns process ID(s), 0 if nothing).

Kjell Thomas Pedersen

unread,
Jul 21, 2015, 5:51:23 AM7/21/15
to weewx...@googlegroups.com

Typed that crontab entry incorrectly, for 10 min it's

*/10 * * * * /home/weewx.... etc
Reply all
Reply to author
Forward
0 new messages