From 781ba8c0dfb628691b48c3475a8a43769e0e91ce Mon Sep 17 00:00:00 2001 From: Wilco de Boer Date: Sat, 18 Feb 2017 18:01:23 +0100 Subject: [PATCH] Make force-stop only wait the entire timeout if needed --- msctl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/msctl b/msctl index f61062f..2f742df 100755 --- a/msctl +++ b/msctl @@ -1137,10 +1137,16 @@ stop() { # @param 1 The world server to forcibly stop. # --------------------------------------------------------------------------- forceStop() { + local WAIT # Try to stop the server cleanly first. sendCommand $1 "stop" sendCommand $1 "end" - sleep 20 + # Wait for the server to shut down. + WAIT=0 + while serverRunning $1 && [ $WAIT -le 20 ]; do + WAIT=$(($WAIT+1)) + sleep 1 + done; # Kill the process id of the world server. kill -9 $(getJavaPID "$1") > /dev/null 2>&1 # Properly clean up.