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:32:08 GMT
Repository: flink
Updated Branches:
  refs/heads/master 49069823b -> e840bbf71


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

This closes #1716.


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

Branch: refs/heads/master
Commit: e840bbf7192aa3667e7ba128adc84cfd8318ddea
Parents: 4906982
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:31:44 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/e840bbf7/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