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

John graysky at archlinux.us
Mon Dec 14 02:08:04 UTC 2020


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


More information about the systemd-devel mailing list