Skip to content

Commit

Permalink
[FLINK-17470][scripts] Use timeout only if present (osx compat)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmetzger committed Nov 20, 2020
1 parent 3a066d6 commit 7e05b33
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions flink-dist/src/main/flink-bin/bin/flink-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,15 @@ function guaranteed_kill {

# send sigterm for graceful shutdown
kill $to_stop_pid
# wait 10 seconds for process to stop. By default, Flink kills the JVM 5 seconds after sigterm.
timeout 10 tail --pid=$to_stop_pid -f /dev/null
if [ "$?" -eq 124 ]; then
echo "Daemon $daemon didn't stop within 10 seconds. Killing it."
# send sigkill
kill -9 $to_stop_pid
# if timeout exists, use it
if command -v timeout &> /dev/null ; then
# wait 10 seconds for process to stop. By default, Flink kills the JVM 5 seconds after sigterm.
timeout 10 tail --pid=$to_stop_pid -f /dev/null
if [ "$?" -eq 124 ]; then
echo "Daemon $daemon didn't stop within 10 seconds. Killing it."
# send sigkill
kill -9 $to_stop_pid
fi
fi
}

Expand Down

0 comments on commit 7e05b33

Please sign in to comment.