Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

#!/bin/bash

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

nice_it

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

This is pretty trivial.

renice -n 10 $$
share|improve this answer
    
Sure, that is it. In some systems, -n is not accepted. –  jeckyll2hide Sep 14 '12 at 13:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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