From b9aee3d824300bb75ee667dad457cc3bfdb86535 Mon Sep 17 00:00:00 2001 From: Daniel Ceregatti Date: Sat, 9 Jul 2022 14:23:43 -0700 Subject: [PATCH] Add RCON file handling. Add RCON client. Add many comments. --- files/dayzserver | 87 ++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/files/dayzserver b/files/dayzserver index 2ba6ca4..2ddfb43 100755 --- a/files/dayzserver +++ b/files/dayzserver @@ -2,28 +2,6 @@ set -eE -# Make sure we don't start collecting core files -# FIXME Set this in Docker somewhere -ulimit -c 0 - -# DayZ SteamID -appid=1042420 -dayz_id=221100 - -config=serverDZ.cfg -port=2302 -profile="-profiles=${HOME}/serverprofile/" - -# To log or not to log -#logs="-dologs -adminlog -netlog" -logs="-nologs" - -# mods="@CF;@community-Online-Tools;@Banov;@SimpleAutorun" -mods="" - -# modify carefully! server won't start if syntax is corrupt! -dayzparameter=" -config=${config} -port=${port} -mod='${mods}' -freezecheck -fps=60 -bepath=${HOME}/serverfiles/battleye ${profile} ${logs}" - # Colors default="\e[0m" red="\e[31m" @@ -34,6 +12,38 @@ blue="\e[34m" magenta="\e[35m" cyan="\e[36m" +# Make sure we don't start collecting core files +# FIXME Set this in Docker somewhere +ulimit -c 0 + +# DayZ Experimental SteamID, because there is no release version of the Linux server yet +appid=1042420 + +# DayZ Release SteamID. This is for mods, as only the release has them. +dayz_id=221100 + +# Command line argument variables +# Server config file +config=serverDZ.cfg +# Server port +port=2302 +rcon_port=2303 +# Server profile directory +profile="-profiles=${HOME}/serverprofile/" +# To log or not to log. +# All possible logging on: +#logs="-dologs -adminlog -netlog" +# No logs? This should read "-somelogs" +logs="-nologs" + +# Mods. WIP. This will have to come from another file, as the plan is to manage this with +# this very script. +# mods="@CF;@community-Online-Tools;@Banov;@SimpleAutorun" +mods="" + +# Put them all together +dayzparameter=" -config=${config} -port=${port} -mod='${mods}' -freezecheck -fps=60 -BEpath=${HOME}/serverfiles/battleye ${profile} ${logs}" + # Base directories CFG_SRC_FILES="/files" SERVER_FILES="${HOME}/serverfiles" @@ -68,8 +78,7 @@ Options and arguments: install - Install the DayZ server files login - Login to Steam - rcon - RCON Features - say - Send a message to players on the server + rcon - Connect to the server using a python RCON client status - Shows the server's status as well as the state of the server files and mods (Needs install, update, etc.) stop - Stop the server update - Update the DayZ server files @@ -124,6 +133,9 @@ fn_loadconfig_dayz(){ fi fi # battleye config and rconpassword setup + # The server creates a new file from this file, which it then uses. + # Let's make sure to delete it first + rm -f "${HOME}/serverfiles/battleye/beserver_x64_active*" BE_SERVER_FILE="${HOME}/serverfiles/battleye/beserver_x64.cfg" if [ ! -f "${BE_SERVER_FILE}" ] then @@ -136,16 +148,20 @@ fn_loadconfig_dayz(){ exit 1 else cat > "${BE_SERVER_FILE}" < ~/py3rcon.config.json } fn_start_dayz(){ @@ -176,7 +192,7 @@ fn_start_dayz(){ } fn_stop_dayz(){ - echo "Stopping DayZ server..." + echo "Stopping DayZ server...(this is not implemented)" } fn_steam_login(){ @@ -316,14 +332,7 @@ fn_workshop_mods(){ } fn_rcon(){ - case "${1}" in - say) - echo "Sending message to server: '${1}'" - ;; - **) - fn_usage rcon "${1}" - ;; - esac + exec py3rcon.py --gui ~/py3rcon.config.json } fn_status(){