Getting sudo and nohup to work together

后端 未结 9 1634
滥情空心
滥情空心 2021-02-02 06:39

Linux newbie here.

I have a perl script which takes two command line inputs. I tried to run it in the background but this is what I got:

[~user]$ nohup s         


        
9条回答
  •  闹比i
    闹比i (楼主)
    2021-02-02 07:18

    Try:

    xterm -e "sudo -b nohup php -S localhost:80 -t /media/malcolm/Workspace/sites &>/dev/null"
    

    When you close xterm, the PHP web server still alive.
    Don't put nohup before sudo or else the PHP web server will be killed after closing xterm.

提交回复
热议问题