I was wondering if there was a way of assigning a process a permanent priority level.
Sure, add Nice=<priority>
to the service file.
2 Likes
How do I add it to the service file?
That depends on whether it’s a system service or a user application:
- If it’s a system service unit then in an override file in
/etc/systemd/system/foo.service.d/override.conf
. Make sure to add[Service]
beforeNice=<priority>
. - If it’s a user application, then you need to find the name of the unit under which the application is run first using
systemd-cgls
for example, and then you can write a similar file in~/.config/systemd/user/foo.service.d/override.conf
Note that Nice levels are now almost meaningless with cgroups and you should use other resource control options: systemd.resource-control
See:
1 Like