Running Jenkins Swarm client as a service via Upstart
Posted by Admin • Wednesday, December 21. 2016 • Category: DevOps, Java, LinuxThis 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:
/etc/init/jenkins-slave.conf
description "Jenkins Slave via Swarm" author "Me" start on runlevel [3] stop on shutdown setuid "MY_USER" setgid "MY_GROUP" #expect fork - do not enable this! respawn respawn limit unlimited script cd /correct/directory java -jar /path/to/swarm.jar SWARM_PARAMS 2>&1 >> LOG_FILE emit jenkinsslave_running 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 Comments
Add Comment