I need to run
nice --20 from script. Problem is: a negative value can be applied only with sudo.
Do you know any way to run
nice command without
sudo or simply run
nice --20 dosemu from script?
Unfortunately, I don't think that's easily doable.
If your dosemu process runs as a separate user, then you can set the priority of all processes of that user to a negative value using
EDIT: silly me, you cannot create a suid shell script, that just doesn't work.
EDIT2: OK, you can configure sudo such that it does not require you to give password when someone from the sudo group runs nice or renice. In a terminal window, enter
This will open a simple text editor that will edit the configuration of sudo. Add the following line at the end of the file:
Exit the editor. The editor will make sure that the syntax is correct (otherwise one could break the system). Now, you can run
and you will not get prompted for a password. In fact, nice will start another process called sudo with the -20 priority. This new sudo process will switch back to your original user (
while it is running, run this:
you will see that
Understandind how safe it is: to make it sure that there is no flaw, try this where you will see it asks the password 2 times because
and this will ask password one time only as it is already root to
PS.: instead of dosemu, for tests, I used
It logs you in as root after which you won't need the sudo.
Then run your script.