brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #498: Use SIGTERM in stop script inside Abstrac...
Date Tue, 03 Jan 2017 16:44:37 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/498#discussion_r94438146
  
    --- 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 --
    
    My point is that `rm` will try to get user input at this point which is what `-f` tries
to avoid. It will still fail on read-only 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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message