I have a script that calls a subscript and attempts to release/disown this script so that Jenkins calling the script can complete successfully. It seems to release the script on the command line, so I can log out or execute other scripts when on the command line (SSH), but Jenkins hangs waiting for the released script to finish. Is there a way around it?



disown -h

echo "Done"
exit 0



while [ false ]; do
  echo "Still Working"
  sleep "5s"

When doing this, Jenkins just hangs endlessly until I kill the subscr execution.


There are two ways I could think of to do this.


The command nohup will run a subcommand completely detached from your terminal, and send its output to a file:

$ nohup ls
appending output to nohup.out
$ cat nohup.out 

GNU screen

GNU screen can serve the same function in this context, of running a command with the output sent elsewhere. It also has the bonus feature of being able to reattach to the stdin and stdout of the process later on without restarting it if necessary. (It's hard to demo screen in a text buffer.)

  • Thanks, this seems to be an issue with the wrapper tha executes Jenkins scripts. I was able to fix this particular need by nohup from the ssh command. I've tested the above and it does work when calling directly from ssh
    – Jeff Ancel
    Dec 20 '11 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.