Skip to content

Commit

Permalink
[FLINK-3517] [dist] Only count active PIDs in start script
Browse files Browse the repository at this point in the history
This closes apache#1716.
  • Loading branch information
uce committed Feb 29, 2016
1 parent 4906982 commit e840bbf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions flink-dist/src/main/flink-bin/bin/flink-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit e840bbf

Please sign in to comment.