Prevented log lines which don't start with a date from causing a problem.

This commit is contained in:
Marcus Whybrow 2012-05-19 22:25:22 +01:00
parent 244617bfe9
commit 3704cbf851

View File

@ -41,7 +41,7 @@ as_user() {
if [ $(whoami) == $SERVER_USER ] ; then if [ $(whoami) == $SERVER_USER ] ; then
bash -c "$1" bash -c "$1"
else else
su - $SERVER_USER -c "$1" su - $SERVER_USER -s /bin/bash -c "$1"
fi fi
} }
@ -53,7 +53,7 @@ as_user() {
# returns: Time in seconds since 1970-01-01 00:00:00 UTC # returns: Time in seconds since 1970-01-01 00:00:00 UTC
log_line_get_time() { log_line_get_time() {
time_string=$(echo $1 | awk '{print $1 " " $2}') time_string=$(echo $1 | awk '{print $1 " " $2}')
date -d "$time_string" "+%s" date -d "$time_string" "+%s" 2> /dev/null
} }
# Watches the log # Watches the log
@ -76,7 +76,7 @@ log_wait_for_line() {
echo $LINE echo $LINE
break break
fi fi
done < <(tail --follow --lines=100 --sleep-interval=0.1 $SERVER_LOG) done < <(as_user "tail --follow --lines=100 --sleep-interval=0.1 $SERVER_LOG")
} }
@ -130,9 +130,9 @@ worlds_get() {
WORLDNAME[$a]=$NAME WORLDNAME[$a]=$NAME
if [ -e ${WORLD_STORAGE_PATH}/$NAME/ramdisk ] if [ -e ${WORLD_STORAGE_PATH}/$NAME/ramdisk ]
then then
WORLDRAM[$a]=0 WORLDRAM[$a]=true
else else
WORLDRAM[$a]=1 WORLDRAM[$a]=false
fi fi
a=$a+1 a=$a+1
fi fi
@ -281,7 +281,6 @@ server_start() {
time=$(now) time=$(now)
printf "Starting server... " printf "Starting server... "
cd $SERVER_PATH
as_user "cd $SERVER_PATH && screen -dmS $SCREEN_NAME $INVOCATION" as_user "cd $SERVER_PATH && screen -dmS $SCREEN_NAME $INVOCATION"
quite $(log_wait_for_line "$CONFIRMATIONS_START" "$time") quite $(log_wait_for_line "$CONFIRMATIONS_START" "$time")
echo "Done." echo "Done."