From 88ed017ca7cfe3bc6299c99ceddd5c3b5b9adb81 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 29 Jan 2020 08:57:31 -0600 Subject: [PATCH] Simplified mcstatus shim to allow for any command Fixes #426 --- mcstatus | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/mcstatus b/mcstatus index 02bf395b..89c62d78 100755 --- a/mcstatus +++ b/mcstatus @@ -1,19 +1,16 @@ #!/bin/bash ##### mcstatus shim for mc-monitor +# handles translating calls to +# mcstatus (host:port) (command) +# where the actual command is ignore, but is typically ping or status addr="$1" -cmd="$2" -if [[ ${cmd} == "ping" ]]; then - IFS=':' - read -a parts <<< "${addr}" - if [[ ${#parts[*]} -gt 1 ]]; then - exec mc-monitor status --host ${parts[0]} --port ${parts[1]} - else - exec mc-monitor status --host ${parts[0]} - fi +IFS=':' +read -a parts <<< "${addr}" +if [[ ${#parts[*]} -gt 1 ]]; then + exec mc-monitor status --host ${parts[0]} --port ${parts[1]} else - echo "ERROR can only shim the 'ping' command" - exit 1 -fi \ No newline at end of file + exec mc-monitor status --host ${parts[0]} +fi