From 9a45da3c6ecdeccd30e07e18a93023cfb08cef39 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 10 Jul 2014 01:50:49 +0200 Subject: [PATCH] Handle (non-existence) of log file smarter in start / wrapper scripts. --- roguelike | 5 ++++- start_server_client_union.sh | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/roguelike b/roguelike index efb362c..a0be8cc 100755 --- a/roguelike +++ b/roguelike @@ -3,4 +3,7 @@ # Wrapper to the script so that its suppressed server messages get read on exit. ./start_server_client_union.sh "$@" sync -cat log +if [ -e ./log ] +then + cat log +fi diff --git a/start_server_client_union.sh b/start_server_client_union.sh index ac161b5..6199e25 100755 --- a/start_server_client_union.sh +++ b/start_server_client_union.sh @@ -3,6 +3,12 @@ # Abort the script on error. set -e +# Don't let any log leftovers from before interfere. +if [ -e ./log ] +then + rm log +fi + # Give helpful message to players that want to start without compiling first. if [ ! -e ./roguelike-server ] then @@ -19,8 +25,6 @@ fi # This script's wrapper script will read it out on exit. ./roguelike-server "$@" > log 2>&1 & -echo TEST >> log - # Give server some time to start up and exit on error. sleep 0.01 -- 2.30.2