Exit zsh, but leave running jobs open?

前端 未结 4 1025
温柔的废话
温柔的废话 2021-01-30 01:25

Just switched from bash to zsh.

In bash, background tasks continue running when the shell exits. For example here, dolphin continues running after the

4条回答
  •  庸人自扰
    2021-01-30 02:03

    I have found that using a combination of nohup, &, and disown works for me, as I don't want to permanently cause jobs to run when the shell has exited.

    nohup  & disown
    

    While just & has worked for me in bash, I found when using only nohup, &, or disown on running commands, like a script that calls a java run command, the process would still stop when the shell is exited.

    • nohup makes the command ignore NOHUP and SIGHUP signals from the shell
    • & makes the process run in the background in a subterminal
    • disown followed by an argument (the index of the job number in your jobs list) prevents the shell from sending a SIGHUP signal to child processes. Using disown without an argument causes it to default to the most recent job.

    I found the nohup and disown information at this page, and the & information in this SO answer.

提交回复
热议问题