From 6e86a3703153a5f1869e858d1a599fcedc0dd1ec Mon Sep 17 00:00:00 2001 From: thehuntedpie Date: Wed, 26 Sep 2018 02:24:10 +0300 Subject: [PATCH] wait for logs to appear and then sleep for a second, *better measure on deciding if command is done* then kill it --- console.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/console.sh b/console.sh index c6ccbb0..58a2024 100755 --- a/console.sh +++ b/console.sh @@ -1,8 +1,18 @@ -#!/bin/bash -x +#!/bin/bash COMMAND=${@}; CONTAINER=mindustry_server; DATE=`date -Iseconds`; echo "$COMMAND" | docker attach $CONTAINER & -sleep 1; -docker logs --since "$DATE" $CONTAINER +PID=$$ + +# reasonably speaking, logs dont happen til action is done +while [ "$LOGS" == "" ]; do + LOGS=$(docker logs --since "$DATE" $CONTAINER) +done + +# sleep just in case stuff is still going on +sleep 1 + +echo "$LOGS" +kill -9 $PID