sudo nohup nice <-- in what order?

Jonah Braun picture Jonah Braun · Dec 8, 2008 · Viewed 16.9k times · Source

So I have a script that I want to run as root, without hangup and nicely. What order should I put the commands in?

sudo nohup nice foo.bash &

or

nohup nice sudo foo.bash &

etc.

I suspect it doesn't matter but would like some insight from those who really know.

Answer

Adam Crume picture Adam Crume · Dec 15, 2009

sudo may not respect niceness. At least, it doesn't on my machine (Ubuntu 9.04). Running this:

nice sudo nice
sudo nice nice

prints out 0 and 10. (Note that 'nice' with no command prints out the current niceness.)