flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject flink git commit: [FLINK-3517] [dist] Only count active PIDs in start script
Date Mon, 29 Feb 2016 09:30:52 GMT
Repository: flink
Updated Branches:
  refs/heads/release-1.0 945f25b97 -> a94aa9c6a


[FLINK-3517] [dist] Only count active PIDs in start script


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/a94aa9c6
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/a94aa9c6
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/a94aa9c6

Branch: refs/heads/release-1.0
Commit: a94aa9c6a7d47d8074120b77fe051f98931c11c6
Parents: 945f25b
Author: Ufuk Celebi <uce@apache.org>
Authored: Fri Feb 26 00:11:48 2016 +0100
Committer: Ufuk Celebi <uce@apache.org>
Committed: Mon Feb 29 10:30:34 2016 +0100

----------------------------------------------------------------------
 flink-dist/src/main/flink-bin/bin/flink-daemon.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/a94aa9c6/flink-dist/src/main/flink-bin/bin/flink-daemon.sh
----------------------------------------------------------------------
diff --git a/flink-dist/src/main/flink-bin/bin/flink-daemon.sh b/flink-dist/src/main/flink-bin/bin/flink-daemon.sh
index f6eab70..2388ba7 100644
--- a/flink-dist/src/main/flink-bin/bin/flink-daemon.sh
+++ b/flink-dist/src/main/flink-bin/bin/flink-daemon.sh
@@ -85,8 +85,16 @@ case $STARTSTOP in
 
         # Print a warning if daemons are already running on host
         if [ -f $pid ]; then
-            count=$(wc -l $pid | awk '{print $1}')
-            echo "[WARNING] $count instance(s) of $DAEMON are already running on $HOSTNAME."
+          active=()
+          while IFS='' read -r p || [[ -n "$p" ]]; do
+            kill -0 $p >/dev/null 2>&1
+            if [ $? -eq 0 ]; then
+              active+=($p)
+            fi
+          done < "${pid}"
+
+          count="${#active[@]}"
+          echo "[INFO] $count instance(s) of $DAEMON are already running on $HOSTNAME."
         fi
 
         echo "Starting $DAEMON daemon on host $HOSTNAME."


Mime
View raw message