Skip to content
This repository has been archived by the owner on Dec 5, 2018. It is now read-only.

Commit

Permalink
Restart slave.jar when it dies.
Browse files Browse the repository at this point in the history
Summary:
Sometimes slave.jar dies due to an OOM error or the like.  In those
cases, make it automatically restart.  Jenkins doesn't notice that
slaves are dead in order to restart it themselves.

Test Plan:
Fingers crossed.  I'll install this on jenkins, terminate all the
jenkins-slave machines on ec2, and run make-allcheck, and make sure
the slaves start up properly.  I don't know what
com.trilead.ssh2.Connection.execCommand does, but it looks like it
just runs the given command in the shell, based on code example jenkinsci#6 at
   http://www.programcreek.com/java-api-examples/index.php?api=com.trilead.ssh2.Session
   >>> sess.execCommand("uname -a && date && uptime && who");

Reviewers: jlfwong

Reviewed By: jlfwong

Subscribers: chris

Differential Revision: http://phabricator.khanacademy.org/D14010
  • Loading branch information
csilvers committed Oct 20, 2014
1 parent 0058d0e commit f1f8fc8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/hudson/plugins/ec2/ssh/EC2UnixLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ else if (bootstrapResult == SAMEUSER) {
"slave.jar","/tmp");

String jvmopts = computer.getNode().jvmopts;
String launchString = "java " + (jvmopts != null ? jvmopts : "") + " -jar /tmp/slave.jar";
String launchString = "while :; do java " + (jvmopts != null ? jvmopts : "") + " -jar /tmp/slave.jar; done";
logger.println("Launching slave agent: " + launchString);
final Session sess = conn.openSession();
sess.execCommand(launchString);
Expand Down

0 comments on commit f1f8fc8

Please sign in to comment.