“sudo nice” versus “nice sudo”

While re-testing the script mentioned in my last post, I decided to play a little safer. I changed “sudo foo” to “nice sudo foo”. However, it turns out that on my machine (running Ubuntu 9.04), processes launched by sudo do not inherit niceness. From a web search, though, I gathered that they do on some other systems such as Mac OS X.

For compatibility, it’s probably better to use “sudo nice foo” instead of “nice sudo foo”. The former will also let you raise priority, which only root can do.

Post a Comment

Your email is never shared. Required fields are marked *