From 8afb1651fdf5f7ef07b8e17840ac01d545d8b049 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Mon, 27 Jan 2020 07:16:22 -0600 Subject: [PATCH] Added shim for mcstatus For #426 --- Dockerfile | 1 + mcstatus | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100755 mcstatus diff --git a/Dockerfile b/Dockerfile index 5e3ea3e6..44e79ffc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,6 +45,7 @@ ARG MC_RUN_VER=1.3.3 RUN easy-add --file mc-server-runner --from https://github.com/itzg/mc-server-runner/releases/download/${MC_RUN_VER}/mc-server-runner_${MC_RUN_VER}_linux_${ARCH}.tar.gz COPY mcadmin.jq /usr/share +COPY mcstatus /usr/local/bin VOLUME ["/data","/mods","/config"] COPY server.properties /tmp/server.properties diff --git a/mcstatus b/mcstatus new file mode 100755 index 00000000..7e712039 --- /dev/null +++ b/mcstatus @@ -0,0 +1,19 @@ +#!/bin/bash + +##### mcstatus shim for mc-monitor + +addr="$1" +cmd="$2" + +if [[ ${cmd} == "ping" ]]; then + IFS=':' + read -a parts <<< "${addr}" + if [[ ${#parts[*]} -gt 1 ]]; then + echo mc-monitor status --host ${parts[0]} --port ${parts[1]} + else + echo mc-monitor status --host ${parts[0]} + fi +else + echo "ERROR can only shim the 'ping' command" + exit 1 +fi \ No newline at end of file