sudo nohup nice <— in what order?

后端 未结 6 1542
南旧
南旧 2021-02-12 13:51

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

noh

6条回答
  •  执念已碎
    2021-02-12 14:03

    I guess all of them do an exec* syscall to pass the ball to the next one, so, whatever the order, it won't leave any hanging processes.

    I'd say that nohup should be last so that the two other don't clober the signal handler. (I'm sure nice does not play with signals, but sudo does.)

    Then, sudo and nice, it all depends on which way you want to alter the scheduling priority with nice.

    • If you want to raise the priority (that is, give a negative value to nice) do sudo before.
    • If you want to lower the priority (give nice a positive value) do it before sudo, as you don't need root privileges.

提交回复
热议问题