Přidat adjust.sh

This commit is contained in:
Radim Lipovčan 2024-06-18 19:06:20 +02:00
parent 8484aec912
commit 0a3b744b74

22
adjust.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
# Check if the environment variable is set
if [ -z "$HOSTNAME" ]; then
echo "hostname environment variable is not set."
exit 1
fi
# 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"
# Get the hostname of the container
HOSTNAME=$(hostname)
# Create or overwrite the server.properties file with the hostname
echo "server-name: $HOSTNAME" > "$FILE_PATH"