Tuesday, April 2, 2013

Run background java process from Jenkins

Jenkins is using mechanism to detect spawned processes and kill them after finishing job, so if you will just start such ad-hoc background daemon process, Jenkins will kill it with warning:

Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information

Fortunately, there is easy hack to tell Jenkins ignore such process, just create fake BUILD_ID and start your application, for example, this can be entered into Execute shell build step:

BUILD_ID=dontKillMe nohup java -jar test.jar &

Warning is still there, but process should be fine and running. There is more about it here.


  1. Replies
    1. The effectiveness of IEEE Project Domains depends very much on the situation in which they are applied. In order to further improve IEEE Final Year Project Domains practices we need to explicitly describe and utilise our knowledge about software domains of software engineering Final Year Project Domains for CSE technologies. This paper suggests a modelling formalism for supporting systematic reuse of software engineering technologies during planning of software projects and improvement programmes in Final Year Project Centers in Chennai.

      Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
      Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

  2. Thanks a lot! I spent 1 day for this problem.

  3. Where i need to give this command, at Jenkins server or client...
    i spent almost one day so far but still no luck.. please give quick answer...

  4. give in batch file ex: set BUILD_ID=dontKillMe nohup java -jar test.jar &
    its worked...

  5. Thanks, it also saved my day :)

  6. This comment has been removed by the author.

  7. if you put nohup java -jar test.jar & in another shell script, call start_up.sh, and execute shell in jenkins: BUILD_ID=dontKillMe nohup start_up.sh &. It DON NOT work! I don't know why and wonder how to fix it..

  8. for anyone else, I had to put the dontkillme line ABOVE the background task in windows ie :

    set BUILD_ID=dontKillMe
    @start /b cmd /c bundle exec thin start

    this problem has wasted me nearly an entire day today :(

  9. Administrations, for example, background checks are more open. Through this article, I am will confer to you the best background check organization accessible on the net.best background investigation services

  10. Background removal services of product images. This service helps E-commerce websites. Good looking product images improve sales… hire background removal service

  11. I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. Thanks for sharing the information keep updating, looking forward to more posts.
    High Quality Product Images

  12. Excellent and very exciting site. Love to watch. Keep Rocking. dungeons and dragons dice

  13. Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking. dnd dice

  14. Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article... but I put things off too much and never seem to get started. Thanks though. toro scarpe nere

  15. Therefore, the service provider will charge you based on the type of fault in your device or machine. Therefore, you may want to ask the pro about how they figure out the service charges Santa Clarita Sub Zero Refrigerator Repair Service