25

Say I run the following on a remote box with the idea of preventing killing the job when I disconnect the terminal.

nohup ./my_script.sh &

When I try to exit my terminal, I got the following warning:

zsh: you have running jobs

I presume that's ok. It's just telling me that I have a job / process running in the background. If I disconnect the terminal, the job/process will continue to run, correct?

1
  • I found that zsh's nohup is broken and doesn't do what you want. Disown works most of the time. Though once I had an issue trying to use disown with ffmpeg in zsh, so started a bash shell and ran nohup inside that. Commented Nov 27, 2016 at 8:26

1 Answer 1

32

Yeah, that's fine. The child process will receive a HUP signal, but the process won't die thanks to your nohup.

If you want to not see that message, simply pass the job id to disown, like so:

disown %1

Or, start the job with &! (zsh-specific trick):

nohup ./my_script.sh &!
1
  • Can the &! trick work on the bash as well?
    – alper
    Commented Dec 25, 2020 at 1:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .