Docker-Image-Minecore-Servers/adjust.sh

25 lines
815 B
Bash
Raw Normal View History

2024-06-18 19:06:20 +02:00
#!/bin/bash
# Check if the environment variable is set
if [ -z "$HOSTNAME" ]; then
echo "hostname environment variable is not set."
exit 1
fi
2024-06-19 09:53:13 +02:00
# Get the hostname of the container
HOSTNAME=$(hostname)
2024-06-18 19:06:20 +02:00
# 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
2024-06-19 11:38:07 +02:00
sed -i "s/^Server_Name: server_name/Server_Name: $HOSTNAME/" $FILE_PATH
2024-06-18 19:06:20 +02:00
FILE_PATH="/data/server.properties"
# Create or overwrite the server.properties file with the hostname
2024-06-19 12:25:29 +02:00
echo "server-name=$HOSTNAME" >> "$FILE_PATH"
echo "enforce-secure-profile=false" >> "$FILE_PATH"
2024-06-22 09:40:09 +02:00
echo "view-distance=6" >> "$FILE_PATH"
echo "difficulty=hard" >> "$FILE_PATH"
sed -i 's/^view-distance=10/view-distance=6/; s/^difficulty=easy/difficulty=hard/' "$FILE_PATH"