Docker-Image-Minecore-Servers/adjust.sh
Radim Lipovčan 2301a91a46
Some checks failed
Build Minecraft Image / Build-Minecraft-Stats-Image (push) Has been cancelled
Aktualizovat adjust.sh
2024-06-19 12:24:51 +02:00

22 lines
639 B
Bash

#!/bin/bash
# Check if the environment variable is set
if [ -z "$HOSTNAME" ]; then
echo "hostname environment variable is not set."
exit 1
fi
# Get the hostname of the container
HOSTNAME=$(hostname)
# Path to the file you want to modify
mkdir -p "/data/plugins/ChatControlRed"
FILE_PATH="/data/plugins/ChatControlRed/bungee.yml"
# Replace the line in the file
sed -i "s/^Server_Name: server_name/Server_Name: $HOSTNAME/" $FILE_PATH
FILE_PATH="/data/server.properties"
# Create or overwrite the server.properties file with the hostname
echo "server-name=$HOSTNAME" > "$FILE_PATH"
echo "enforce-secure-profile=false" > "$FILE_PATH"