PID file not created in version 5.0.2

230 views
Skip to first unread message

silke

unread,
Mar 9, 2024, 10:19:59 PM3/9/24
to weewx-user
Hello,

I recently made the switch to v5 and overall the migration was working quite smoothly, despite running many extensions and skins. I'm on Ubuntu and use DEB installation.

The one thing that is not working yet is my weewx process health monitoring which is based on PID file. I cannot get weewx to create a PID file whatever I try. (in v4 this worked out of the box)

I'm adding the --pidfile option to the systemd file, and it shows correctly in the process list:

weewx     941451 51.1  8.7 1921212 1415068 ?     Ssl  23:00   3:23 python3 /usr/share/weewx/weewxd.py /etc/weewx/weewx.conf --pidfile /run/weewx/weewx.pid

the folder /run/weewx is owned by weewx:weewx 

silke@enterprise:/etc/weewx$ ls -la /run/weewx/
total 0
drwxrwxr-x  2 weewx weewx   40 Mär  9 23:00 .
drwxr-xr-x 50 root  root  1420 Mär  9 23:00 ..

but still, no file is getting created upon restart.

Anyone having an idea what I'm doing wrong?

Thanks a lot, Silke

Tom Keffer

unread,
Mar 9, 2024, 10:35:10 PM3/9/24
to weewx...@googlegroups.com
I don't know what I can add to the comments I already made on the issues list: the --pidfile option is only used if you use the --daemon option.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/fb454ef9-ae53-4211-bf15-283bd067c567n%40googlegroups.com.

silke

unread,
Mar 9, 2024, 10:54:02 PM3/9/24
to weewx-user
I'm sorry I saw your response a bit too late after posting here! Your comments were really helpful 

In case there are others out there using monit, this is my new working config for weewx (avoiding use of PID altogether):

check program weewx with path "/usr/bin/systemctl --quiet is-active weewx"
if status != 0 then alert
if status != 0 then exec "/usr/bin/systemctl start weewx.service"
if 10 restarts within 10 cycles then timeout

Thomas Hackler

unread,
Apr 25, 2024, 1:16:33 PM4/25/24
to weewx-user
Hello Silke,
I added your config for weewx to my monit config file but for my case it doesn't work. I have the problem that sometimes my gw1000 driver didn't work, probalby because of wifi problems. See topic here:


It happened yesterday again but monit did not start weewx.

Maybe you can help me?
Regards
Thomas

silke

unread,
Apr 26, 2024, 7:40:13 PM4/26/24
to weewx-user
Hi Thomas,
hm, what is the status code your weewx is showing when it dies (e.g. check "journatctl -xau weewx" and scroll back to the time of death) ? And does your monit log show any action?

My weewx is quite stable these days, so I resorted to testing monit operation by killing the weewx process manually (kill -9). It went into "failed" state:

silke@enterprise:~/bin$ sudo service weewx status
× weewx.service - WeeWX
     Loaded: loaded (/lib/systemd/system/weewx.service; enabled; preset: enabled)
     Active: failed (Result: signal) since Fri 2024-04-26 21:04:10 CEST; 2min 32s ago
   Duration: 3d 12h 10min 45.985s
       Docs: https://weewx.com/docs
    Process: 2517884 ExecStart=weewxd /etc/weewx/weewx.conf (code=killed, signal=KILL)
   Main PID: 2517884 (code=killed, signal=KILL)
        CPU: 2d 52min 45.729s

[...]
Apr 26 21:04:10 enterprise systemd[1]: weewx.service: Main process exited, code=killed, status=9/KILL
Apr 26 21:04:10 enterprise systemd[1]: weewx.service: Failed with result 'signal'.
Apr 26 21:04:10 enterprise systemd[1]: weewx.service: Consumed 2d 52min 45.729s CPU time.

and then about 3mins later monit detected it and kicked in and started it again: 

silke@enterprise:~/bin$ tail -f /var/log/monit.log
[2024-04-26T21:07:02+0200] error    : 'weewx' status failed (3) -- no output
[2024-04-26T21:07:02+0200] info     : 'weewx' exec: '/usr/bin/systemctl start weewx.service'
[2024-04-26T21:07:02+0200] error    : 'weewx' status failed (3) -- no output
[2024-04-26T21:09:03+0200] info     : 'weewx' status succeeded (0) -- no output
[2024-04-26T21:09:04+0200] info     : 'weewx' status succeeded (0) -- no output

which took another 2mins to fully succeed. 

Hope this helps,
Silke
Reply all
Reply to author
Forward
0 new messages