Question

service stop sometimes

Good morning! I show you a .service that randomly stops sometimes but it won’t restart. I would like to see what it would be possible to do to make it restart automatically and quickly!

[Unit] Description=Emby Server is a personal media server with apps on just about every device. After=network.target [Service] EnvironmentFile=/etc/emby-server.conf WorkingDirectory=/opt/emby-server ExecStart=/opt/emby-server/bin/emby-server RestartForceExitStatus=3 User=emby [Install] WantedBy=multi-user.target

As it does not stop frequently, I would like to know if this way the problem would be solved!

[Unit] Description=Emby Server is a personal media server with apps on just about ever> After=network.target

[Service] EnvironmentFile=/etc/emby-server.conf WorkingDirectory=/opt/emby-server ExecStart=/opt/emby-server/bin/emby-server User=emby Restart=on-failure RestartSec=5s

[Install] WantedBy=multi-user.target

Thank you!

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @CuteSeaGreenDolphin,

DigitalOcean has a pretty good tutorial that explains such cases here:

https://www.digitalocean.com/community/tutorials/how-to-configure-a-linux-service-to-start-automatically-after-a-crash-or-reboot-part-1-practical-examples

Having said that, what you’ve written looks like it should work however usually when a service crashes it’s because the Droplet has killed it or there was an issue with said service. This means that most probably it won’t start again.

In such cases, I often urge people to check the logs and see why this behavior is seen. Usually, services shouldn’t crash.