From: Christian Heller Date: Sat, 5 Mar 2016 20:59:07 +0000 (+0100) Subject: Wrapper script: Give server ten seconds to wind down properly. X-Git-Tag: tce~83 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bprefix%7D%7D?a=commitdiff_plain;h=4baa56d0423a8d59f794e10f7e5f65747613265a;p=plomrogue Wrapper script: Give server ten seconds to wind down properly. --- diff --git a/roguelike b/roguelike index cad9b70..b997a9f 100755 --- a/roguelike +++ b/roguelike @@ -1,8 +1,16 @@ #!/bin/sh # Wrapper to the script so that its suppressed server messages get read on exit. -# and server_run/ get's deleted in any case. ./start_server_client_union.sh "$@" + +# Give server up to ten seconds to wind down properly. +i=0 +while [ -e ./server_run/in ] && [ $i -le 100 ] +do + echo 'QUIT' >> server_run/in + sleep 0.1 + i=`expr $i + 1` +done rm -rf ./server_run/ # For some reason, mere sync won't ensure a log is written out, so wait a while.