brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #498: Use SIGTERM in stop script inside Abstrac...
Date Wed, 21 Dec 2016 14:18:36 GMT
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/498#discussion_r93444913
  
    --- Diff: software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
---
    @@ -613,22 +614,27 @@ 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",
    +                        "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.",
    +                        "     PID=\"\"",
    +                        "     break",
    +                        "  fi",
    +                        "  sleep 1",
    +                        "done",
    +                        "if test -n $PID; then",
    +                        "  kill -9 $PID",
    +                        "  echo Process $PID stopped with SIGKILL",
    +                        "fi");
                     if (processOwner != null) {
    -                    s.body.append(
    -                            "export PID=$(" + BashCommands.sudoAsUser(processOwner, "cat
"+pidFile) + ")",
    -                            "test -n \"$PID\" || exit 0",
    -                            BashCommands.sudoAsUser(processOwner, "kill $PID"),
    -                            BashCommands.sudoAsUser(processOwner, "kill -9 $PID"),
    -                            BashCommands.sudoAsUser(processOwner, "rm -f "+pidFile)
    --- End diff --
    
    Did you mean to remove the `rm -rf` of the pidFile? If so, why?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message