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?
1 Answer
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.
nice -19 ionice -c 3 command
?nice
orionice
every time.