Change nice level of currently running script

dangonfast asked:

I would like to change the nice level of the currently running script:


nice_it ( ) {
    ps -o "%p %r %y %x %n %c %a"


That does not work, since nice tries to change the nice level of the command started by it.

Is it possible to achieve this in bash?

My answer:

This is pretty trivial.

renice -n 10 $$

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.