From 4cb4a4409d01b97b96d78de0ac4c1b8ddc6c18a9 Mon Sep 17 00:00:00 2001 From: Daniel Ceregatti Date: Mon, 15 May 2023 08:56:51 -0700 Subject: [PATCH] Mount each script into /usr/local/bin. Keep separating out the functionality between the two scripts. --- docker-compose.yml | 7 ++++--- files/dz-common | 15 -------------- web/bin/dz | 51 +++------------------------------------------- 3 files changed, 7 insertions(+), 66 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 12b97ba..b1baedc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,8 +23,9 @@ services: - serverfiles:/serverfiles - mods:/serverfiles/steamapps/workshop/content - mpmissions:/serverfiles/mpmissions - - ./files:/files:ro - - ./web:/web:ro + - ./files:/files + - ./web/bin/dz:/usr/local/bin/dz + - ./web:/web ports: - "8000:8000/tcp" restart: no @@ -38,7 +39,7 @@ services: - mpmissions:/serverfiles/mpmissions - profiles:/profiles - ./files:/files - - ./bin:/files/bin + - ./server/bin/dz:/usr/local/bin/dz # To have the server show up in the LAN tab of the DayZ launcher, # it must run under host mode. network_mode: host diff --git a/files/dz-common b/files/dz-common index 57db69e..541b3ff 100755 --- a/files/dz-common +++ b/files/dz-common @@ -35,19 +35,11 @@ release_client_appid=221100 CFG_SRC_FILES="/files" SERVER_FILES="/serverfiles" -# Server container base directories -SERVER_PROFILE="/profiles" - -mkdir -p ${SERVER_FILES}/battleye - # Server configuration file SERVER_CFG_FILE="serverDZ.cfg" SERVER_CFG_DST="${SERVER_FILES}/${SERVER_CFG_FILE}" SERVER_CFG_SRC="${CFG_SRC_FILES}/${SERVER_CFG_FILE}" -# Command line parameters except mod, as that is handled separately. -parameters="-config=${SERVER_CFG_FILE} -port=${port} -freezecheck -BEpath=${SERVER_FILES}/battleye -profiles=${SERVER_PROFILE} -nologs" - # Used to check if dayZ is installed SERVER_INSTALL_FILE="${SERVER_FILES}/DayZServer" @@ -66,13 +58,6 @@ fi declare -a workshopID workshopfolder="${SERVER_FILES}/steamapps/workshop/content/${release_client_appid}" -# Backups -BACKUP_DIR="${HOME}/backup" -if [ ! -d "${BACKUP_DIR}" ] -then - mkdir -p "${BACKUP_DIR}" -fi - # Other stuff YES="${green}yes${default}" NO="${red}no${default}" diff --git a/web/bin/dz b/web/bin/dz index ced4a73..c3e9f1f 100755 --- a/web/bin/dz +++ b/web/bin/dz @@ -89,22 +89,6 @@ install(){ fi } -# Make sure to clean up and report on exit, as these files remain in the container's volume -report() { - rm -f /tmp/mod_command_line /tmp/parameters - echo - echo -e "${yellow}========================================== error.log ==========================================" - find "${SERVER_PROFILE}" -name error.log -exec head {} \; -exec tail -n 30 {} \; -exec rm -f {} \; - echo - echo -e "========================================== script*.log ========================================" - find "${SERVER_PROFILE}" -name "script*.log" -exec head {} \; -exec tail -n 30 {} \; -exec rm -f {} \; - echo - echo -e "========================================== *.RPT ==============================================" - find "${SERVER_PROFILE}" -name "*.RPT" -exec ls -la {} \; -exec tail -n 30 {} \; -exec rm -f {} \; - echo - echo -e "========================================== End log ======================================${default}" -} - # Update the server files. update(){ dologin @@ -192,7 +176,7 @@ list(){ done } -# Display the status of the provisioning container +# Display the status of everything status(){ INSTALLED="${NO}" LOGGED_IN="${NO}" @@ -214,28 +198,6 @@ status(){ ANONYMOUS="${green}(not anonymous)${default}" fi fi - # Running or not - if pidof DayZServer > /dev/null - then - # Uptime - D=$(date +%s) - F=$(date +%s -r ${SERVER_PROFILE}/server_console.log) - DAYS=$(( (${D} - ${F}) / 86400 )) -# UPTIME=$(date --date="$(( ${D} - ${F} ))" +"${DAYS} days %H:%M:%S") - UPTIME="${DAYS} days "$(date -d@$(($(date +%s) - $(date +%s -r ${SERVER_PROFILE}/server_console.log))) -u +"%H hours %M minutes %S seconds") - - RUNNING="${YES}\nUptime: ${green}${UPTIME}${default}" - # Current parameters - RUNNING="${RUNNING}\nRunning Parameters: $(cat /tmp/parameters)\nRunning mod parameter: $(cat /tmp/mod_command_line)" - fi - mod_cmd - MAP="none" - # Map name - if [[ -f ${SERVER_CFG_DST} ]] - then - MAP=$(grep -E "template=" ${SERVER_CFG_DST} | grep -vE "^//") - fi - # Number of mods plus the list denoting on or off echo -ne " Logged in to Steam: ${LOGGED_IN} ${ANONYMOUS} Server files installed: ${INSTALLED}" @@ -245,6 +207,7 @@ Server files installed: ${INSTALLED}" echo exit 0 fi + # Mods echo -ne " Mods: " MODS=$(list) @@ -252,15 +215,7 @@ Mods: " then echo -n "none" fi - echo -e "${MODS} -Server running: ${RUNNING} -Working parameters: ${parameters} -Working mod parameter: ${mod_command_line}" - if [[ "${INSTALLED}" = "${YES}" ]] - then - MAP=$(grep template ${SERVER_CFG_DST} | grep -v "^//" | cut -d= -f2 | cut -d\; -f1) - echo "Map: ${MAP}" - fi + echo -e "${MODS}" } # Capture the first argument and shift it off so we can pass $@ to every function