0

I want my games and certain programs (such as WINE) to be automatically given a higher priority then everything else, and while I'm at it I probably want to adjust the niceness value of a few other things like my window manager to be given a higher priority as well.

So is there any way to give a niceness level to a program before starting it? So, for example, I want the Steam program to always be run at niceness level -20 to give it priority over everything else. I don't want to have to run it in the command line like this "nice -n -20 steam" every time.

A script could work well enough I suppose for those programs, but that doesn't solve it for things like services. For example, I might want to change the nice value of my window manager, which is started by my display manager, which is started by a service.

0

It's the purpose of nice and renice commands. You are on the good way.

You can create a program launcher with that kind of option depending on what desktop environement you are running.

Here is an example under Gnome-desktop : https://linuxconfig.org/how-to-create-desktop-shortcut-launcher-on-ubuntu-18-04-bionic-beaver-linux

Best regards, feel free to ask me for more details.

0

Suggestion: realias the commands that are invoked interactively.

This can be done per user (in your .bashrc file) eg: alias slow_command="nice -n 16 command" or systemwide. For example in a Debian-like setup you could add your own file with alias directives in /etc/profile.d/.

Here's how: How can I preset aliases for all users?

Or simply edit your launchers. This may be a good option for desktop shortcuts and provides more flexibility since you could have different launchers with different priorities depending on your system load or the mood of the moment.

If you want to set niceness at service level systemd units can be configured as such. See Unit directives.
I understand that the Nice directive should be under [Service]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.