This commit is contained in:
2023-11-29 06:58:07 -06:00
parent a9a87303c2
commit dfe20d9fed

View File

@@ -235,39 +235,41 @@ EOF
# 07. Main loop # 07. Main loop
# =================================================== # ===================================================
main() { main() {
cd "$ORIGINAL_DIR" || die "Can no longer cd to $ORIGINAL_DIR" while true ; do
cd "$ORIGINAL_DIR" || die "Can no longer cd to $ORIGINAL_DIR"
if [ -e ./SERVER.ENV ] ; then if [ -e ./SERVER.ENV ] ; then
. ./SERVER.ENV . ./SERVER.ENV
else else
die "Could not source ./SERVER.ENV" die "Could not source ./SERVER.ENV"
fi fi
# this must be here and not up top as we must load it from the SERVER.ENV # this must be here and not up top as we must load it from the SERVER.ENV
export SERVER_HOME="$SERVERS/$SERVER_NAME" export SERVER_HOME="$SERVERS/$SERVER_NAME"
# create directories in $SERVER_HOME, blank the modstring # create directories in $SERVER_HOME, blank the modstring
init_server init_server
if [ -e ./serverDZ.cfg ] ; then if [ -e ./serverDZ.cfg ] ; then
cp -f ./serverDZ.cfg "$SERVER_HOME"/ || die "Failed to copy ./serverDZ into $SERVER_HOME" cp -f ./serverDZ.cfg "$SERVER_HOME"/ || die "Failed to copy ./serverDZ into $SERVER_HOME"
else else
die "Could not find ./serverDZ.cfg" die "Could not find ./serverDZ.cfg"
fi fi
# trigger update for remote server game/map/mod files # trigger update for remote server game/map/mod files
# for this, the current machine needs to have ssh-copy-id done # for this, the current machine needs to have ssh-copy-id done
# or else will ask for password # or else will ask for password
ssh steam@dayz-modserver 'sh /home/steam/dayz-servers/modserver_update.sh' ssh steam@dayz-modserver 'sh /home/steam/dayz-servers/modserver_update.sh'
# sync remote server stock and mod files into local cache # sync remote server stock and mod files into local cache
refresh_local_cache || die "Failed to refresh local cache." refresh_local_cache || die "Failed to refresh local cache."
# load stock server, map, mod files into $SERVER_HOME # load stock server, map, mod files into $SERVER_HOME
setup_environment || die "Failed to setup environment." setup_environment || die "Failed to setup environment."
# START THE SERVER - RUN ServerDZ.EXE # START THE SERVER - RUN ServerDZ.EXE
start_server "$@" start_server "$@"
done
} }
main "$@" || exit 1 main "$@" || exit 1