I'm seeing this on all my Pis and my Ubuntu VM. I'm no systemd expert, but 
a created a pull request that works for me. 
https://github.com/weewx/weewx/pull/767
rich

On Friday, 2 April 2021 at 10:36:50 UTC-4 Graham Eddy wrote:

> using the provided weewx.service on an RPi, ‘sudo systemctl stop weewx’ 
> sends SIGKILL instantly (twice), which is a very unclean termination of 
> weewx and causes me problems. has anyone encountered this and has a proper 
> fix?
>
> so far as i can tell from the manuals (particularly ‘systemd.kill' and 
> ‘systemd.service’), this is defective behaviour by systemd - it should send 
> a SIGTERM followed by a SIGKILL (if necessary) 90 secs later by default. 
> instead, i can only stop it sending SIGKILL by setting 
> ‘FinalKillSignal=SIGTERM’ in weewx.service, where systemd sends SIGTERM 
> twice instead. ‘KillSignal=SIGTERM’ is ignored
>
> my workaround is ‘SendSIGKILL=no’ in weewx.service, which nicely sends 
> SIGTERM for clean shutdown, but there is no followup SIGwhatever for 
> contingent termination of rogue process(es)
>
> weewx.service with workaround is:
>
> # systemd configuration for weewx
>
> [Unit]
> Description=weewx weather system
> Requires=time-sync.target
> After=time-sync.target
> RequiresMountsFor=/home
>
> [Service]
> ExecStart=/home/weewx/bin/weewxd --daemon --pidfile=/run/weewx/weewx.pid 
> /home/weewx/weewx.conf
> ExecReload=/bin/kill -HUP $MAINPID
> Type=forking
> PIDFile=/run/weewx/weewx.pid
> User=weewx
> Group=weewx
> SendSIGKILL=no  # workaround to stop SIGKILL sent instantly (systemd bug)
>
> [Install]
> WantedBy=multi-user.target
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/469ec21b-7c5c-4cbd-896d-6b0d39653a5cn%40googlegroups.com.

Reply via email to