3

Is it possible to set up some sort of default process and IO priority for given application/executable? I am thinking some sort of FS extended attribute or loadable "policy" of sort?

4
  • 1
    What's wrong with nice -19 ionice -c 3 command? – FloHimself Apr 20 '15 at 7:30
  • 1
    @FloHimself I think @wilx is asking for some way of having the system automatically apply prorities to an executable whenever it is launched, without having to use nice or ionice every time. – Stephen Kitt Apr 20 '15 at 8:13
  • 1
    @FloHimself: Yes, I want the policy to be automatically applied exactly like Stephen Kitt suggests. – wilx Apr 20 '15 at 8:29
  • The question should be expanded with some more background information. Why should this be done? What's the special use case? – FloHimself Apr 20 '15 at 11:04
3

The usual approach is to create a wrapper script.

Create a script /usr/local/bin/nicer:

#!/bin/sh
exec ionice -c3 nice /usr/bin/"${0##*/}" "$@"

Create symbolic links for each executable that you want to execute through this wrapper, e.g.

ln -s nicer /usr/local/bin/myprogram

Then when you run myprogram, it will execute the script /usr/local/bin/myprogram, which runs /usr/bin/myprogram with lower priorities.

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.