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.
If negative niceness is desired, I would do: sudo nohup nice command because according to `info coreutils' nohup should preceed nice. If I want a negative nice value, sudo must come before, since only root is able to use negative nice values.
If positive niceness is desired, I would do simply: nohup nice sudo command This ensures that nohup and nice are not run with root privileges.
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.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With