Merge pull request #428 from renderorange/update-to-print-error-if-error-on-startup

Add check for successful server startup
This commit is contained in:
Alexander Savchuk 2023-04-29 19:10:36 +12:00 committed by GitHub
commit 4e16a77a11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1432,14 +1432,21 @@ server_start() {
# Wait for the server to fully start
server_log_dots_for_lines "$1" "$time_now" "${SERVER_CONSOLE_EVENT_OUTPUT_START[$1]}" "${SERVER_CONSOLE_EVENT_TIMEOUT_START[$1]}"
if [[ -f "${SERVER_PATH[$1]}"/eula.txt ]]; then
if ! grep -q -i 'eula=true' "${SERVER_PATH[$1]}"/eula.txt; then
echo " Could not start the server as you first need to agree to an EULA. See eula.txt for more info (${SERVER_PATH[$1]}/eula.txt)."
return
# Ensure the server started
if server_is_running "$1"; then
echo " Done."
else
if [[ -f "${SERVER_PATH[$1]}"/eula.txt ]]; then
if ! grep -q -i 'eula=true' "${SERVER_PATH[$1]}"/eula.txt; then
echo " Failed."
echo "Could not start the server as you first need to agree to an EULA. See eula.txt for more info (${SERVER_PATH[$1]}/eula.txt)."
return
fi
fi
fi
echo " Done."
# TODO: trap and return the error to help troubleshoot startup issues
echo " Failed."
fi
fi
}