From 0a3b744b7431e4bd25da5d10e7f62c8515731786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radim=20Lipov=C4=8Dan?= Date: Tue, 18 Jun 2024 19:06:20 +0200 Subject: [PATCH] =?UTF-8?q?P=C5=99idat=20adjust.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adjust.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 adjust.sh diff --git a/adjust.sh b/adjust.sh new file mode 100644 index 0000000..e0972c0 --- /dev/null +++ b/adjust.sh @@ -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" \ No newline at end of file