kodi.service - Systemd service unit to run Kodi in standalone mode without the need for a DE.
DESCRIPTION
NOTES ON SYSTEM SHUTDOWN/REBOOT
Be aware that this service runs Kodi in systemd's user.slice not in the system.slice. In order to have Kodi gracefully exit, the system should be called to shutdown or to reboot using the respective Kodi actions not by a call to systemctl.
This is NOT recommended:
# systemctl reboot
If you do reboot or shutdown via a call to systemctl, this will result in systemd killing the cg too quickly and data loss to your Kodi profile will occur. When Kodi exits cleanly, it will save GUI settings, media settings, Kodi uptime etc. In principal this is no different than data loss occurring from a user doing work when a sysadmin issues a reboot command without prior warning. While it is possible to run Kodi in systemd's system.slice instead, doing so makes it difficult to use USB mounts within Kodi and to use pulseaudio for Kodi sessions.
RECOMMENDED METHODS TO SHUTDOWN/REBOOT
Here are several options:
o Select the corresponding option under Power menu in the Kodi GUI.
o Use the official Android/iOS remote app.
o If a CLI option is preferred, use kodi-send to issue the command to reboot or shutdown like so:
$ kodi-send -a "Reboot"
$ kodi-send -a "ShutDown()"
Note that kodi-send is provided by the kodi-xxx-eventclients package where xxx is either, rpi, rpi-legacy, or git depending on which package group you installed.
Certain use cases require environment variables to be passed to the service. Define these variables in /etc/conf.d/kodi-standalone and they will be passed along to the service.