Skip to content

Commit

Permalink
fix(server): root
Browse files Browse the repository at this point in the history
  • Loading branch information
lafayettegabe committed Dec 24, 2024
1 parent 6d0da09 commit 91cb2ea
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions main.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

CONFIG_FILE="/home/root/Zomboid/Server/servertest.ini"
CONFIG_FILE="/root/Zomboid/Server/servertest.ini"

log_info() {
echo "INFO: $1"
Expand All @@ -14,7 +14,8 @@ log_error() {
create_config_file() {
if [ ! -f "$CONFIG_FILE" ]; then
log_info "Configuration file not found. Creating a new one at $CONFIG_FILE."
cat <<EOL >"$CONFIG_FILE"
mkdir -p "$(dirname "$CONFIG_FILE")"
cat >"$CONFIG_FILE" <<EOF
[General]
PublicName=DefaultServerName
PublicDescription=Default server description
Expand Down Expand Up @@ -42,11 +43,8 @@ SleepNeeded=true
SteamScoreboard=admin
PlayerBumpPlayer=true
HoursForLootRespawn=1000
EOL
chown pzuser:pzuser "$CONFIG_FILE"
EOF
chmod 644 "$CONFIG_FILE"
else
log_info "Configuration file already exists: $CONFIG_FILE"
fi
}

Expand All @@ -60,7 +58,6 @@ update_config() {
}

log_info "Starting configuration updates..."

create_config_file

log_info "SERVER_NAME=$SERVER_NAME"
Expand All @@ -85,7 +82,6 @@ if [ -n "$SERVER_MODS_COLLECTION_URL" ]; then
fi

log_info "Configuration updates complete."

log_info "Logging the contents of the updated configuration file ($CONFIG_FILE):"
cat "$CONFIG_FILE"

Expand Down

0 comments on commit 91cb2ea

Please sign in to comment.