Mount each script into /usr/local/bin.

Keep separating out the functionality between the two scripts.
This commit is contained in:
Daniel Ceregatti 2023-05-15 08:56:51 -07:00
parent 71004b4fcc
commit 4cb4a4409d
3 changed files with 7 additions and 66 deletions

View file

@ -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

View file

@ -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}"

View file

@ -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