Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems
Java Linux

Running Jenkins Swarm client as a service via Upstart

Posted by Admin • Wednesday, December 21. 2016 • Category: DevOps, Java, Linux

This turned out to be fairly simple, with only one gotcha: do not follow the how-to's out there that tell you to use expect fork. The process doesn't technically fork. When I had that setting enabled, upstart commands would hang under very specific but repeatable conditions (if the process was killed externally).

So, here is my upstart conf file:


  1. description "Jenkins Slave via Swarm"
  2. author "Me"
  4. start on runlevel [3]
  5. stop on shutdown
  7. setuid "MY_USER"
  8. setgid "MY_GROUP"
  10. #expect fork  - do not enable this!
  11. respawn
  12. respawn limit unlimited
  14. script
  15. cd /correct/directory
  16. java -jar  /path/to/swarm.jar SWARM_PARAMS 2>&1 >> LOG_FILE
  17. emit jenkinsslave_running
  18. end script

Note that the log file is somewhat ineffective - I'm still getting stdout in /var/log/upstart/jenkins-slave.log but stderr in LOG_FILE

0 Trackbacks

  1. No Trackbacks


Display comments as (Linear | Threaded)
  1. No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.

Markdown format allowed

Submitted comments will be subject to moderation before being displayed.