Search code examples
bashjenkinsnohup

Bash script not outputting nohup.out + Jenkins


I have a bash script that I am calling from a build step in Jenkins. Within this bash script is a nohup command for calling a different script in the background, such as:

#!/bin/bash
nohup otherScript.sh &

After the build step completes I go to the path where the nohup.out should have been created, but there is nothing there. Any ideas on what is going on?


Solution

  • You should make sure that the output goes into your build's workspace. This will avoid permission problems with other directories.

    nohup otherScript.sh > $WORKSPACE/scriptOutput.txt 2>&1 &