Skip to content

Commit

Permalink
[Arma 3] Added RPT logging (#253)
Browse files Browse the repository at this point in the history
- Adds RPT logging (logs will be located in `/home/container/serverprofile/rpt/`, but only if `-noLogs` is not used as a startup parameter)
- Fixes edge case where clearing HC cache on first boot may fail due to a missing `serverprofile/` folder.
  • Loading branch information
mdangerf authored Jul 7, 2024
1 parent efc8507 commit 681ffc4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion games/arma3/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,12 @@ if [[ ${MODS_LOWERCASE} == "1" ]]; then
done
fi

# Define the log file path with a timestamp
LOG_FILE="/home/container/serverprofile/rpt/arma3server_$(date '+%m_%d_%Y_%H%M%S').rpt"

# Ensure the logs directory exists
mkdir -p /home/container/serverprofile/rpt

# Clear HC cache, if specified
if [[ ${CLEAR_CACHE} == "1" ]]; then
echo -e "\n${GREEN}[STARTUP]: ${CYAN}Clearing Headless Client profiles cache...${NC}"
Expand Down Expand Up @@ -395,7 +401,11 @@ fi
# Start the Server
echo -e "\n${GREEN}[STARTUP]:${NC} Starting server with the following startup command:"
echo -e "${CYAN}${modifiedStartup}${NC}\n"
${modifiedStartup}
if [[ "$STARTUP_PARAMS" == *"-noLogs"* ]]; then
${modifiedStartup}
else
${modifiedStartup} 2>&1 | tee -a "$LOG_FILE"
fi

if [ $? -ne 0 ]; then
echo -e "\n${RED}PTDL_CONTAINER_ERR: There was an error while attempting to run the start command.${NC}\n"
Expand Down

0 comments on commit 681ffc4

Please sign in to comment.