Added support for xmllint on start to avoid issues with silent errors
This commit is contained in:
parent
bce8f095fd
commit
eb393896ac
@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
echo_rgb() {
|
echo_rgb() {
|
||||||
# Echo a colored string to the terminal based on rgb values
|
# Echo a colored string to the terminal based on rgb values
|
||||||
#
|
#
|
||||||
@ -221,7 +220,6 @@ start_server() {
|
|||||||
|
|
||||||
backup_configs "${server_directory}"
|
backup_configs "${server_directory}"
|
||||||
|
|
||||||
|
|
||||||
local server_port
|
local server_port
|
||||||
server_port="$((START_PORT_RANGE + server_id))"
|
server_port="$((START_PORT_RANGE + server_id))"
|
||||||
|
|
||||||
@ -258,6 +256,18 @@ start_server() {
|
|||||||
|
|
||||||
mv "temp-serverconfig.xml" "${server_config}"
|
mv "temp-serverconfig.xml" "${server_config}"
|
||||||
|
|
||||||
|
# xmllint, helps avoiding the random server launch failures for apparently no reason
|
||||||
|
if which xmllint >/dev/null 2>&1; then
|
||||||
|
for xml_file in "${server_directory}"/*.xml; do
|
||||||
|
log "info" "Linting $(important "${xml_file}")..."
|
||||||
|
if ! xmllint "${xml_file}" > /dev/null; then
|
||||||
|
log "error" "Xml parsing error in ${xml_file}, resolve the error and attempt to start again"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
log "warning" "$(important "xmllint") not installed or not in PATH, skipping lint check"
|
||||||
|
fi
|
||||||
|
|
||||||
log "info" "Starting $(important "${server_name}") located at $(important "${server_directory}") on port $(important "${server_port}")"
|
log "info" "Starting $(important "${server_name}") located at $(important "${server_directory}") on port $(important "${server_port}")"
|
||||||
|
|
||||||
if tmux has-session -t "${server_session_name}" >/dev/null 2>&1; then
|
if tmux has-session -t "${server_session_name}" >/dev/null 2>&1; then
|
||||||
@ -506,7 +516,6 @@ backup() {
|
|||||||
|
|
||||||
[[ -z "${server_id}" ]] && log "error" "No server id passed" && exit 1
|
[[ -z "${server_id}" ]] && log "error" "No server id passed" && exit 1
|
||||||
|
|
||||||
|
|
||||||
# Kill the server to ensure a smooth backup
|
# Kill the server to ensure a smooth backup
|
||||||
kill_server -s "${server_id}" >/dev/null 2>&1
|
kill_server -s "${server_id}" >/dev/null 2>&1
|
||||||
|
|
||||||
@ -626,7 +635,6 @@ usage() {
|
|||||||
Exposes options to backup 7 Days To Die Servers, pass -h to it for details"
|
Exposes options to backup 7 Days To Die Servers, pass -h to it for details"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
# Parse input arguments
|
# Parse input arguments
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user