[systemd-devel] service kills application differently on shutdown vs on stop

Andrei Borzenkov arvidjaar at gmail.com
Mon Dec 14 05:39:09 UTC 2020


14.12.2020 05:08, John пишет:
> If I call systemctl to shutdown or reboot, the effect is that it does
> not honor kodi-x11.service's ExecStop= line which results in an
> unclean exit of kodi and of data loss since kodi writes out some data
> when it exits.  By contrast, calling systemctl to stop the service
> works as expected.
> 
> Does anyone with more knowledge that I understand the differences with
> respect to this aspect of stopping a service as it relates to:
> 
> 1) systemctl stop kodi-x11 (which behaves as expected)
> 2) systemctl reboot (which does not behave as expected)
> 
> Here is kodi-x11.service:
> 
> [Unit]
> Description=Kodi standalone (X11)
> After=remote-fs.target systemd-user-sessions.service

If your application creates user session, on shutdown systemd will stop
existing sessions and it happens independently of your service.

> network-online.target nss-lookup.target sound.target bluetooth.target
> polkit.service upower.service mysqld.service
> Wants=network-online.target polkit.service upower.service
> Conflicts=getty at tty1.service
> 
> [Service]
> User=kodi
> Group=kodi
> EnvironmentFile=-/etc/conf.d/kodi-standalone
> PAMName=login
> TTYPath=/dev/tty1
> Environment=WINDOWING=x11
> ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1
> ExecStop=/usr/bin/killall --user kodi --exact --wait kodi-x11
> Restart=on-abort
> StandardInput=tty
> StandardOutput=journal
> 
> [Install]
> Alias=display-manager.service
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 



More information about the systemd-devel mailing list