Recently I’ve been having a problem where the Emby server kept dying. I haven’t been able to figure out what is causing it. So while I’ve been trying to figure it out with the Emby folks, I fixed up the systemd script for Emby so that it would restart itself whenever it died. It was incredibly simple to do this. Here’s the original script:
[Unit] Description=Emby Media Server After=network.target [Service] EnvironmentFile=/etc/emby-server.conf ExecStart=/usr/lib/emby-server/emby-server.sh start Restart=on-abort TimeoutSec=20 ExecStopPost=/usr/lib/emby-server/emby-server.sh clear [Install] WantedBy=multi-user.target
And here’s how I fixed it:
[Unit] Description=Emby Media Server After=network.target [Service] EnvironmentFile=/etc/emby-server.conf ExecStart=/usr/lib/emby-server/emby-server.sh start Restart=on-abort TimeoutSec=20 ExecStopPost=/usr/lib/emby-server/emby-server.sh clear [Install] WantedBy=multi-user.target [Service] Restart=always
It’s pretty easy. When you’re done you just need to run
systemctl daemon-reload systemctl restart emby-server
And you’re good to go.