From 46ae755028e82fec106ee1dbaeaf0b8fe51609b9 Mon Sep 17 00:00:00 2001 From: TheiLLeniumStudios <104288623+TheiLLeniumStudios@users.noreply.github.com> Date: Mon, 6 Feb 2023 14:28:10 +0000 Subject: [PATCH] Use icecon instead --- Dockerfile | 17 ++++++++++++----- entrypoint.sh | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 51fdd52..37c88d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,12 +3,19 @@ FROM alpine:3.17 RUN apk add --no-cache curl tar git -ARG RCON_VERSION="0.10.2" +# Use icecon instead. For some reason rcon-cli doesn't send a valid command +#ARG RCON_VERSION="0.10.2" +# +#RUN curl -LO https://github.com/gorcon/rcon-cli/releases/download/v${RCON_VERSION}/rcon-${RCON_VERSION}-amd64_linux.tar.gz && \ +# tar -xvf rcon-${RCON_VERSION}-amd64_linux.tar.gz && \ +# mv rcon-${RCON_VERSION}-amd64_linux/rcon /usr/local/bin/ && \ +# rm -rf rcon-${RCON_VERSION}-amd64_linux* -RUN curl -LO https://github.com/gorcon/rcon-cli/releases/download/v${RCON_VERSION}/rcon-${RCON_VERSION}-amd64_linux.tar.gz && \ - tar -xvf rcon-${RCON_VERSION}-amd64_linux.tar.gz && \ - mv rcon-${RCON_VERSION}-amd64_linux/rcon /usr/local/bin/ && \ - rm -rf rcon-${RCON_VERSION}-amd64_linux* +ARG ICECON_VERSION="v1.0.0" + +RUN curl -LO https://github.com/icedream/icecon/releases/download/${ICECON_VERSION}/icecon_linux_amd64 && \ + mv icecon_linux_amd64 /usr/local/bin/icecon && \ + chmod +x /usr/local/bin/icecon # Copies your code file from your action repository to the filesystem path `/` of the container COPY entrypoint.sh /entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh index ae233d8..7960e10 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -78,11 +78,11 @@ if ! is_array_empty "$resources_to_restart"; then echo "Will restart individual resources" for resource in $resources_to_restart; do echo "Restarting ${resource}" - rcon -a "${SERVER_IP}:${SERVER_PORT}" -p "${RCON_PASSWORD}" command "ensure ${resource}" + icecon --command "ensure ${resource}" "${SERVER_IP}:${SERVER_PORT}" "${RCON_PASSWORD}" done else echo "Will restart the whole server" - rcon -a "${SERVER_IP}:${SERVER_PORT}" -p "${RCON_PASSWORD}" command 'txaEvent "serverShuttingDown" "{"delay":5000,"author":Server Owner,"message":"Server restarting."}"' + icecon --command 'txaEvent "serverShuttingDown" "{"delay":5000,"author":Server Owner,"message":"Server restarting."}"' "${SERVER_IP}:${SERVER_PORT}" "${RCON_PASSWORD}" fi else echo "Nothing to restart"