laconic-network-bootstrap/scripts/command-on-all-nodes.sh

24 lines
475 B
Bash
Raw Permalink Normal View History

#!/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}"