Add script to run a command on all nodes

This commit is contained in:
David Boreham 2024-07-31 14:55:19 -06:00
parent 73ad574b89
commit 202436dc2b

23
scripts/command-on-all-nodes.sh Executable file
View File

@ -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 <machine-name-prefix> <command>"
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}"