• Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • None
    • Tasks
    • 7
    • 9
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      In linux, users can make scripts or task to run in the background by appending an ampersand (&) to the script. This will let other task to run smoothly. We have tested this behaviour with the Android emulator in Bamboo where we created a script with the following:

      export ANDROID_HOME="/home/sultan/development/android-sdk-linux"
      export PATH=${PATH}:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools
      echo $PATH
      emulator -avd my_android1.5 -no-window -noaudio &
      echo $JAVA_HOME
      

      The task runs smoothly with the emulator started successfully but the build keeps on running for ever unless we manually kill the emulator. This causes the build to block other tasks from running.

          Form Name

            [BAM-11887] Launching Tasks in the Background from Bamboo fails

            I am having this issue on windows.

            I require a python program to be running a simulator so I can run GUI tests through Squish.

            Guyverthree added a comment - I am having this issue on windows. I require a python program to be running a simulator so I can run GUI tests through Squish.

            For me it only works with:

            /bin/bash -c 'nohup pythonw ./script.py argument  > /dev/null 2>&1 &'
            

            Michel Lawaty added a comment - For me it only works with: /bin/bash -c 'nohup pythonw ./script.py argument > /dev/null 2>&1 &'

            Yeah, this is a major blocker for us. Why would such a basic feature be broken?

            Spencer Williams added a comment - Yeah, this is a major blocker for us. Why would such a basic feature be broken?

            I had the same problem and neither

            nohup
            

            , nor

            command &
            disown -a 
            

            helped

            What helped at the end is:

            echo "$COMMAND > output.log 2>&1" | at now + 1 min
            command 
            

            Moataz Elmasry added a comment - I had the same problem and neither nohup , nor command & disown -a helped What helped at the end is: echo "$COMMAND > output.log 2>&1" | at now + 1 min command

            I'm facing the same issue but in another context.

            https://support.atlassian.com/browse/BSP-12429

            Basically I'm trying to start a java program, leaving it running in the background, and capturing the PID. Somehow the agent in bamboo hangs waiting for a sort of return or something...

            felipe ieder added a comment - I'm facing the same issue but in another context. https://support.atlassian.com/browse/BSP-12429 Basically I'm trying to start a java program, leaving it running in the background, and capturing the PID. Somehow the agent in bamboo hangs waiting for a sort of return or something...

            Here is what does work

            #!/bin/sh
            
            source setup-env.sh
            source setup-config.sh
            
            nohup ./startup-server </dev/null>/dev/null 2>&1 &
            
            sleep 60s
            

            Mehul Sanghvi added a comment - Here is what does work #!/bin/sh source setup-env.sh source setup-config.sh nohup ./startup-server </dev/ null >/dev/ null 2>&1 & sleep 60s

            We are having similar issues. We have a script that is used to setup the environment and other config related variables before starting up one of our servers. The server is started using a shell script and put into the background. Bamboo waits forever and ever:

            #!/bin/sh
            
            source setup-env.sh
            source setup-config.sh
            
            ./startup-server &
            
            sleep 60s
            
            

            It just hangs and waits forever. If I stop the job, it exits out of the task and moves onto the next task or two before the jobs is completely stopped.
            Or I kill the process that is started by startup-server and it moves onto subsequent tasks.

            Please make this a higher priority than just Minor. This is an important feature to have.

            Mehul Sanghvi added a comment - We are having similar issues. We have a script that is used to setup the environment and other config related variables before starting up one of our servers. The server is started using a shell script and put into the background. Bamboo waits forever and ever: #!/bin/sh source setup-env.sh source setup-config.sh ./startup-server & sleep 60s It just hangs and waits forever. If I stop the job, it exits out of the task and moves onto the next task or two before the jobs is completely stopped. Or I kill the process that is started by startup-server and it moves onto subsequent tasks. Please make this a higher priority than just Minor. This is an important feature to have.

            We have a similar problem with Bamboo on a Windows machine. We would like to restart our Tomcat server after our main build, as we our Tomcat instance is dedicated for our WAR files and these WAR files share libraries in Tomcat's lib folder. However, when running the .bat file that starts Tomcat, the build will continue indefinitely. The .bat file returns (uses the windows start command internally) with an exit code of 0, but Bamboo still waits for some process. In Linux one might try nohup, but in windows, start is the closest thing to nohup.

            Using the tomcat7.exe service wrapper did not help either, the same result, Tomcat starts but Bamboo does not consider the build complete.

            Nils Peuser added a comment - We have a similar problem with Bamboo on a Windows machine. We would like to restart our Tomcat server after our main build, as we our Tomcat instance is dedicated for our WAR files and these WAR files share libraries in Tomcat's lib folder. However, when running the .bat file that starts Tomcat, the build will continue indefinitely. The .bat file returns (uses the windows start command internally) with an exit code of 0, but Bamboo still waits for some process. In Linux one might try nohup, but in windows, start is the closest thing to nohup. Using the tomcat7.exe service wrapper did not help either, the same result, Tomcat starts but Bamboo does not consider the build complete.

            I think this is much more than minor, this is the single blocking issue for TDD on android using bamboo.

            Aaron Drake added a comment - I think this is much more than minor, this is the single blocking issue for TDD on android using bamboo.

            This isn't really a problem in bamboo.
            I suspect bamboo is running something like

            $ ssh <host> "command"

            Then, if the command starts a background task it waits for each child to finish to return.
            The solution is to wrap the SSH command within a nohup call. Take a look here for a more complete answer http://stackoverflow.com/questions/29142/getting-ssh-to-execute-a-command-in-the-background-on-target-machine

            Hope it helps

            Diego López León added a comment - This isn't really a problem in bamboo. I suspect bamboo is running something like $ ssh <host> "command" Then, if the command starts a background task it waits for each child to finish to return. The solution is to wrap the SSH command within a nohup call. Take a look here for a more complete answer http://stackoverflow.com/questions/29142/getting-ssh-to-execute-a-command-in-the-background-on-target-machine Hope it helps

              Unassigned Unassigned
              smaiyaki Sultan Maiyaki (Inactive)
              Votes:
              46 Vote for this issue
              Watchers:
              35 Start watching this issue

                Created:
                Updated: