Running process in background after closing terminal

后端 未结 2 1758
面向向阳花
面向向阳花 2020-12-16 00:47

I am trying to run a script in the background even after closing the terminal. I have searched and searched and tried nohup and disown but neither

2条回答
  •  生来不讨喜
    2020-12-16 01:28

    Starting a subshell and running the nohup command from there seems to avoid having Terminal kill it off when exiting.

    bash -c "nohup sh -c 'while true; do date; sleep 1; done' &"
    

    Not very elegant, but works for me.

提交回复
热议问题