Github user bostko commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/498#discussion_r94437835
--- Diff:
software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
---
@@ -613,22 +614,29 @@ protected ScriptHelper newScript(Map<String, ?>
flags, String phase) {
// no pid, not running; 1 is not running
s.requireResultCode(Predicates.or(Predicates.equalTo(0),
Predicates.equalTo(1)));
} else if (STOPPING.equals(phase)) {
+ String stopCommand = Joiner.on('\n').join("PID=$(cat
"+pidFile + ")",
+ "test -n \"$PID\" || exit 0",
+ "SIGTERM_USED=\"\"",
+ "for i in $(seq 1 16); do",
+ " if ps -p $PID > /dev/null ; then",
+ " kill $PID",
+ " echo $PID is still running.",
+ " else",
+ " echo Process $PID stopped successfully.",
+ " SIGTERM_USED=\"true\"",
+ " break",
+ " fi",
+ " sleep 1",
+ "done",
+ "if test -z $SIGTERM_USED; then",
+ " kill -9 $PID",
+ " echo Process $PID stopped with SIGKILL",
+ "fi",
+ "rm " + pidFile);
--- End diff --
It script fails stop will exit with non-zero code.
I think scripts started by Apache Brooklyn shouldn't be modified read-only
externally and if so stop is better to fail.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---