Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got a script that backs up minecraft worlds, when ran by command (nice -19 ./ it doesn't lag what so ever, server load stays low. When I try to do nice -19 ./ in a cronjob, it doesn't "nice" it and it uses a high amount of server resources. Isn't there a renice command? Can't I some how input that in the code to make it renice itself everytime it runs? But how would I get the PID of the script?

Thank you!

share|improve this question

migrated from Apr 16 '13 at 0:54

This question came from our site for professional and enthusiast programmers.

Firstly this doesn't belong on stackoverflow. 2ndly: which user are you doing this as? Thirdly: you're misinterpreting nice. If it does use lots of CPUs it's most likely doing the right thing in cron. -19 is a "totally not nice" niceness. -20 is the highest priority, 19 is the lowest. Normal users can only do nicenesses from 0 to 19. Only root can do negative. – tink Apr 15 '13 at 21:14
@tink - nice -10 <cmd> isn't "minus 19", it's usually interpreted as plus 19 althoug the correct form would be nice -n 10 <cmd> – mata Apr 15 '13 at 22:02
ta :) for the feedback, can't edit my comment any more :/ – tink Apr 15 '13 at 22:17

Inside your script you should both renice it and ionice it, e.g. in bash:


renice 19 -p $$
ionice -c 3 -p $$


The $$ in bash stands for the process ID of the current bash.

share|improve this answer

Your Answer


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