Bash_Scripts/Mordhau/Mordhau-Start-Server.bash
2021-07-17 23:54:09 -05:00

48 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/bash --posix
#
# Commmand-Line Options:
# -PORT
# -QUERYPORT
# -GAMEINI
# -ENGINEINI
# -BEACONPORT
# -RCONPORT
# -LOG
# -USEALLAVAILABLECORES
#
# Note: When establishing server CLI options, if they are Key-Value
# associated, they cannot be delimited via spaces; instead,
# they must use -KEY=VALUE notation.
#
[[ "${1}" == "" ]] && echo "Error - Invalid Server ID" \
&& echo " Usage: Mordhau-Start-Server [Server-ID] ? [--preserve]" \
&& exit 1
[[ "${1}" != "" ]] && set +e
steamcmd +quit
steamcmd +login anonymous +force_install_dir /home/Mordhau/Server-${1} +app_update 629800 validate +quit
[[ "${2}" == "--preserve" ]] || rm -r -f "/home/Mordhau/Server-${1}/Mordhau/Content/.modio"
[[ "$(id -u)" == "0" ]] && tmux new-session -d -s "Mordhau-Server-${1}" \
/home/Mordhau/Server-${1}/MordhauServer.sh \
-Port="777${1}" -QueryPort="2700${1}" \
-BeaconPort="1500${1}" -RCONPort="2600${1}" \
-LOG -USEALLAVAILABLE
[[ "$(id -u)" != "0" ]] && tmux new-session -d -s \
"Mordhau-Server-${1}" \
/home/Mordhau/Server-${1}/MordhauServer.sh \
-Port="777${1}" -QueryPort="2700${1}" \
-BeaconPort="1500${1}" -RCONPort="2600${1}" \
-LOG -USEALLAVAILABLE
[[ ${?} == 0 ]] && echo "Successfully Started Server"
[[ ${?} != 0 ]] && echo "Server Return Code: ${?}"
exit 0