sudo nohup nice <— in what order?

后端 未结 6 1534
南旧
南旧 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:19

    ~ $ sudo nohup nice whoami
    nohup: ignoring input and appending output to `nohup.out'
    ~ $ sudo cat nohup.out 
    root
    

    The difference between the first and second way you've done it is who owns the nohup.out file. sudo first will make it owned by root, nohup before sudo will make it owned by your user.

提交回复
热议问题