jellyfin-mpv-shim icon indicating copy to clipboard operation
jellyfin-mpv-shim copied to clipboard

systemd service file

Open darkdragon-001 opened this issue 3 years ago • 3 comments

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.

darkdragon-001 avatar Jan 03 '21 21:01 darkdragon-001

[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

DoM1niC avatar Apr 30 '22 13:04 DoM1niC

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)

Spirarementum avatar May 16 '22 08:05 Spirarementum

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.

Simon1511 avatar Jan 03 '24 12:01 Simon1511