2024-10-16, 03:50 PM
You can modify the jellyfin service file to require that a mount be present before attempting to start.
Modify /etc/systemd/system/multi-user.target.wants/jellyfin.service and add "RequiresMountFor" in the [Service] section. I've provided an example below.
I want to note that this will only work if you've defined your SMB mount in /etc/fstab. RequiresMountFor uses the fstab parameters to determine when the mount is actually available.
Modify /etc/systemd/system/multi-user.target.wants/jellyfin.service and add "RequiresMountFor" in the [Service] section. I've provided an example below.
Code:
[Unit]
Description = Jellyfin Media Server
After = network-online.target
[Service]
RequiresMountsFor=/media/library
Type = simple
EnvironmentFile = /etc/default/jellyfin
User = jellyfin
Group = jellyfin
WorkingDirectory = /var/lib/jellyfin
ExecStart = /usr/bin/jellyfin $JELLYFIN_WEB_OPT $JELLYFIN_FFMPEG_OPT $JELLYFIN_SERVICE_OPT $JELLYFIN_NOWEBAPP_OPT $JELLYFIN_ADDITIONAL_OPTS
Restart = on-failure
TimeoutSec = 15
SuccessExitStatus=0 143
[Install]
WantedBy = multi-user.target
I want to note that this will only work if you've defined your SMB mount in /etc/fstab. RequiresMountFor uses the fstab parameters to determine when the mount is actually available.