jellyfin-mpv-shim
jellyfin-mpv-shim copied to clipboard
systemd service file
Is your feature request related to a problem? Please describe.
I would like to autostart jellyfin-mpv-shim
on a systemd system.
Describe the solution you'd like Add a systemd service file which can be enabled to automatically start after boot.
Describe alternatives you've considered xdg autostart requires a desktop to be installed.
Additional context I would like to run this on a RaspberryPi with the Raspbian-Lite image (no desktop) to reduce overhead as much as possible.
[Unit]
Description=Jellyfin Client
After=network.target
[Service]
User=root
Group=root
ExecStart=/usr/bin/xinit /usr/local/bin/jellyfin-mpv-shim
RestartSec=5
Restart=always
[Install]
WantedBy=multi-user.target
This solution is not working for me. Jellyfin-mpv-shim client appears not to be running in the Desktop and is absent from the Task Tray. Lauching manually in a Terminal windows does work.
$ sudo systemctl start jellyfin-mpv-shim.service $ sudo systemctl status jellyfin-mpv-shim.service ● jellyfin-mpv-shim.service - Jellyfin Client Loaded: loaded (/etc/systemd/system/jellyfin-mpv-shim.service; disabled; vendor preset: enabled) Active: active (running) since Mon 2022-05-16 19:57:18 NZST; 57s ago Main PID: 3535 (xinit) Tasks: 2 (limit: 4461) Memory: 308.0K CGroup: /system.slice/jellyfin-mpv-shim.service └─3535 /usr/bin/xinit /usr/local/bin/jellyfin-mpv-shim
May 16 19:57:18 Bug xinit[3536]: (EE) Server is already active for display 0 May 16 19:57:18 Bug xinit[3536]: If this server is no longer running, remove /tmp/.X0-lock May 16 19:57:18 Bug xinit[3536]: and start again. May 16 19:57:18 Bug xinit[3536]: (EE) May 16 19:57:18 Bug xinit[3536]: (EE) May 16 19:57:18 Bug xinit[3536]: Please consult the The X.Org Foundation support May 16 19:57:18 Bug xinit[3536]: at http://wiki.x.org May 16 19:57:18 Bug xinit[3536]: for help. May 16 19:57:18 Bug xinit[3536]: (EE) May 16 19:57:33 Bug xinit[3548]: X connection to :0 broken (explicit kill or server shutdown)
In case this is still relevant, here's my working service:
[Unit]
Description=Jellyfin Client
After=network.target
[Service]
Type=simple
ExecStartPre=/usr/bin/sleep 30
ExecStart=/usr/bin/python3 /usr/local/bin/jellyfin-mpv-shim
ExecStop=/bin/kill -s SIGINT $MAINPID
Restart=on-failure
[Install]
WantedBy=default.target
Put this into /etc/systemd/user/jellyfin-mpv-shim.service, enable and start it. Before actually starting Jellyfin-MPV-Shim it will wait 30 seconds to make sure the user has logged in/everything is ready.