summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-10-17 11:30:06 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-10-19 09:42:59 +0000
commit44bbc13b88b2d0aed117178e9dc5da7cab4246ee (patch)
tree84a80b40de9c00112f48b8beae541c12a6b3410c
parente038e92d86fce2df7e50071436ceac5cf0a9ba24 (diff)
HONEYCOMB-157: fix honeycomb-kill script
Change-Id: I10c5446d17cecec00188dc69389bbc85c90ce652 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
-rw-r--r--common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/StartupScriptGenerator.groovy10
-rw-r--r--common/common-scripts/src/main/resources/scripts/killScript2
2 files changed, 7 insertions, 5 deletions
diff --git a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/StartupScriptGenerator.groovy b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/StartupScriptGenerator.groovy
index 65245b2e0..566a90d1f 100644
--- a/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/StartupScriptGenerator.groovy
+++ b/common/common-scripts/src/main/groovy/io/fd/honeycomb/common/scripts/StartupScriptGenerator.groovy
@@ -55,14 +55,15 @@ class StartupScriptGenerator {
def debugJvmParameters = properties.getOrDefault(JVM_DEBUG_PARAMS_KEY, DEFAULT_DEBUG_JVM_PARAMS)
log.debug "Debug JVM properties: ${additionalJvmParameters}"
- def jvmParameters = "${additionalJvmParameters} -jar \$(dirname \$0)/${project.artifactId}-${project.version}.jar"
+ def jarName = "${project.artifactId}-${project.version}.jar"
+ def jvmParameters = "${additionalJvmParameters} -jar \$(dirname \$0)/${jarName}"
def scriptParent = Paths.get(project.build.outputDirectory, MINIMAL_RESOURCES_FOLDER)
scriptParent.toFile().mkdirs()
def startScriptPath = generateStartupScript(jvmParameters, log, scriptParent, scriptTemplate)
def forkScriptPath = generateForkingStartupScript(scriptParent, log)
def debugScriptPath = generateDebugStartupScript(debugJvmParameters, jvmParameters, log, scriptParent, scriptTemplate)
- def killScriptPath = generateKillScript(log, scriptParent)
+ def killScriptPath = generateKillScript(jarName, log, scriptParent)
generateReadme(scriptParent, log, startScriptPath, forkScriptPath, debugScriptPath, killScriptPath, project)
}
@@ -111,9 +112,10 @@ class StartupScriptGenerator {
flushScript(scriptPath, new SimpleTemplateEngine().createTemplate(scriptTemplate).make(["exec": exec]).toString())
}
- private static def generateKillScript(log, scriptParent) {
+ private static def generateKillScript(jarName, log, scriptParent) {
+ def pattern = "java.*${jarName}"
def scriptPath = Paths.get(scriptParent.toString(), KILL_SCRIPT_NAME)
log.info "Writing kill script to ${scriptPath}"
- flushScript(scriptPath, new SimpleTemplateEngine().createTemplate(KILL_SCRIPT_TEMPLATE).make().toString())
+ flushScript(scriptPath, new SimpleTemplateEngine().createTemplate(KILL_SCRIPT_TEMPLATE).make(["pattern": pattern]).toString())
}
}
diff --git a/common/common-scripts/src/main/resources/scripts/killScript b/common/common-scripts/src/main/resources/scripts/killScript
index a32aaa6b6..b7fe0ec8b 100644
--- a/common/common-scripts/src/main/resources/scripts/killScript
+++ b/common/common-scripts/src/main/resources/scripts/killScript
@@ -1,2 +1,2 @@
#!/bin/sh -
-kill `ps aux | grep 'java.*honeycomb' | awk '{print \$2}' \ No newline at end of file
+kill `ps aux | grep '${pattern}' | grep -v grep | awk '{print \$2}'` \ No newline at end of file