i am setting up weex on a new raspberry pi (re-aquainting with debian after years away - it has changed!).
at this stage, i am using simulator driver.
weewx runs non-root as wxsys:wxsys quite happily (with pidfile in weewx/run/ not /var/run/), generating graphs etc, no problems in log
"/etc/init.d/weewx start" starts up weewx okay, pidfile is correct
"/etc/init.d/weewx stop" hangs for ~60 secs, then *says* stopped at shell prompt, but weewx is still running, syslog says stop failed, and systemctl reports weewx.service to be in failed state. syslog also says “non-root pidfile is insecure” but i think that’s just a warning
is this (weewx not stopping) a known problem and, if so, is there a fix? couldn't find anything pertinent in weewx-user forum, nor anything helpful asking dr google
i thought maybe a dependency wasn’t being satisfied leading to hanging until timeout, so
in /etc/init.d/weex’s LSB comment i changed Required-Stop label to Should-Stop, which didn’t help, so i tried setting Required-Stop value to $none, which also didn’t help
i noticed that the 60 secs hang after issuing stop instruction corresponds to default timeout, so
i tried adding “—retry TERM/5/KILL/2” to “start-stop-daemon —stop” in case weewx missed first SIGTERM, and we know start-stop-daemon doesn’t check that daemon has actually stopped unless it is told to with —retry. this didn’t help
i tried manually sending SIGTERM to weewxd process during this hang period, and start-stop-daemon immediately noticed and completed successfully, including removing pidfile. in this case, i had killed weewxd process so not running, and systemctl did not report weewx.service to be in failed state, so it was happy.
this has lead to my current workaround, where i replace
start-stop-daemon —stop —pidfile $WEEWX_PID
with
start-stop-daemon —stop —pidfile $WEEWX_PID &
sleep 2 ; kill $(cat $WEEWX_PID) ; wait
which shuts weewx down neatly but i’d prefer a proper solution
cheers