From 202436dc2bc8416449afee37d975b460939b242d Mon Sep 17 00:00:00 2001 From: David Boreham Date: Wed, 31 Jul 2024 14:55:19 -0600 Subject: [PATCH] Add script to run a command on all nodes --- scripts/command-on-all-nodes.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 scripts/command-on-all-nodes.sh diff --git a/scripts/command-on-all-nodes.sh b/scripts/command-on-all-nodes.sh new file mode 100755 index 0000000..0537e63 --- /dev/null +++ b/scripts/command-on-all-nodes.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Run a specified deployment subcommand on all nodes + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source ${SCRIPT_DIR}/lib.sh + +usage="Usage: $0 " + +if [[ -n "$1" ]]; then + machine_name_prefix=$1 +else + echo ${usage} + exit 1 +fi + +if [[ -n "$2" ]]; then + command=$2 +else + echo ${usage} + exit 1 +fi + +run_on_all_nodes ${machine_name_prefix} "${command}"