Added log prefixes (#444)

This commit is contained in:
Malcolm Nihlén
2020-03-06 16:52:17 +01:00
committed by GitHub
parent 74df4b6a9c
commit 1e334ca7d5
18 changed files with 172 additions and 141 deletions

View File

@@ -3,36 +3,36 @@
. /start-utils
if [ -n "$OPS" ]; then
echo "Setting/adding ops"
log "Setting/adding ops"
rm -rf ops.txt.converted
echo $OPS | awk -v RS=, '{print}' > ops.txt
fi
if [ -n "$WHITELIST" ]; then
echo "Setting whitelist"
log "Setting whitelist"
rm -rf white-list.txt.converted
echo $WHITELIST | awk -v RS=, '{print}' > white-list.txt
fi
if [ -n "$ICON" -a ! -e server-icon.png ]; then
echo "Using server icon from $ICON..."
log "Using server icon from $ICON..."
# Not sure what it is yet...call it "img"
curl -sSL -o /tmp/icon.img $ICON
specs=$(identify /tmp/icon.img | awk '{print $2,$3}')
if [ "$specs" = "PNG 64x64" ]; then
mv /tmp/icon.img /data/server-icon.png
else
echo "Converting image to 64x64 PNG..."
log "Converting image to 64x64 PNG..."
convert /tmp/icon.img -resize 64x64! /data/server-icon.png
fi
fi
# Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades)
echo "Checking for JSON files."
log "Checking for JSON files."
JSON_FILES=$(find . -maxdepth 1 -name '*.json')
for j in $JSON_FILES; do
if [[ $(cat $j | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') == "" ]]; then
echo "Fixing JSON $j"
log "Fixing JSON $j"
echo '[]' > $j
fi
done
@@ -41,7 +41,7 @@ done
# If any modules have been provided, copy them over
mkdir -p /data/mods
if [ -d /mods ]; then
echo "Copying any mods over..."
log "Copying any mods over..."
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /mods /data
fi
@@ -49,7 +49,7 @@ fi
for c in /config/*
do
if [ -f "$c" ]; then
echo Copying configuration `basename "$c"`
log Copying configuration `basename "$c"`
cp -rf "$c" /data/config
fi
done
@@ -57,7 +57,7 @@ done
mkdir -p /data/plugins
if [ "$TYPE" = "SPIGOT" ]; then
if [ -d /plugins ]; then
echo "Copying any Bukkit plugins over..."
log "Copying any Bukkit plugins over..."
# Copy plugins over using rsync to allow deeply nested updates of plugins
# only updates files if the source file is newer and print updated files
rsync -a --out-format="update:%f:Last Modified %M" --prune-empty-dirs --update /plugins /data
@@ -76,7 +76,7 @@ if [[ ${GUI} = false || ${GUI} = FALSE ]]; then
fi
# put these prior JVM_OPTS at the end to give any memory settings there higher precedence
echo "Setting initial memory to ${INIT_MEMORY:=${MEMORY}} and max to ${MAX_MEMORY:=${MEMORY}}"
log "Setting initial memory to ${INIT_MEMORY:=${MEMORY}} and max to ${MAX_MEMORY:=${MEMORY}}"
expandedDOpts=
if [ -n "$JVM_DD_OPTS" ]; then
@@ -111,7 +111,7 @@ EOF
fi
cd "${FTB_DIR}"
echo "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
log "Running FTB ${FTB_SERVER_START} in ${FTB_DIR} ..."
if isTrue ${DEBUG_EXEC}; then
set -x
fi
@@ -122,7 +122,7 @@ else
bootstrapArgs="--bootstrap /data/bootstrap.txt"
fi
echo "Starting the Minecraft server..."
log "Starting the Minecraft server..."
JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
if isTrue ${DEBUG_EXEC}; then
set -x