Jump to content

Can I set niceness for the emby service?


joshinils
Go to solution Solved by Q-Droid,

Recommended Posts

joshinils

I set a niceness of -5 for the emby processes via htop, but that doesnt persist through restarts (sudo service emby-server start).
Creating a copy of "/usr/lib/systemd/system/emby-server.service" to "/etc/systemd/system/emby-server.service" and editing it to be:

[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=/usr/bin/nice -n -5 /opt/emby-server/bin/emby-server
RestartForceExitStatus=3
User=emby

[Install]
WantedBy=multi-user.target

Doesn't work.

Plainly calling "sudo nice -n -5 /opt/emby-server/bin/emby-server" does start emby with niceness of -5, but of course that doesn't start it as a service.

I know that I know too little about systemd to understand this as is, which is why I ask here.

Link to comment
Share on other sites

  • Solution
Q-Droid

Clean way to do this is with a service unit override.

1. Stop emby and restore the original unit file.

2. Verify that the unit file has the original ExecStart command:
$ systemctl show emby-server |grep ExecStart

3. Create a unit override to add the Nice parameter. This will open an editor where you can add Nice=-5 to the service block.
$ systemctl edit emby-server

Add:
[Service]
Nice=-5

4. Exit and save the override file. Y and enter for the prompts.

5. Start the Emby server. And run top/htop to verify the new nice value.

 

  • Like 4
  • Thanks 2
Link to comment
Share on other sites

joshinils

Thank you!
That worked perfectly.

Now I can watch stuff without interruptions while the same machine is busy with handbrake.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...