diff --git a/bin/run-on-all-nodes b/bin/run-on-all-nodes new file mode 100755 index 0000000..69f7c2f --- /dev/null +++ b/bin/run-on-all-nodes @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -e + +_dir="$( dirname -- "$0" )/.." +_lib="$_dir/lib.sh" +_var="$_dir/var.sh" + +source "$_lib" +source "$_var" + +if ! $_goahead; then + echo -n "failed to load libs and vars" + exit +fi + +echo "preparing to run $* on all nodes" + +_self="$(uname -n)" + +set +e +echo "running on self" +ssh -n "$_self" "$@" +set -e + +get-targets | while read -r line; do + if ! ignore "$line"; then + echo "running on $line" + ssh -n "$line" "$@" & + fi +done diff --git a/bin/scp-to-all-nodes b/bin/scp-to-all-nodes new file mode 100755 index 0000000..2ad9f27 --- /dev/null +++ b/bin/scp-to-all-nodes @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -e + +source lib.sh + +_targetFile="$1" + +if ! [[ -f "$_targetFile" ]]; then + echo -n "file not found: $1" + exit 1 +fi + +echo "preparing to copy $1 to all nodes" + +_targetDir=":" + +if [[ -z "$2" ]]; then + _targetDir+="~" +else + _targetDir+="$2" +fi + +echo -n "target directory: '" +echo -n "$_targetDir" | tr -d ':' +echo "'" + +get-targets | while read -r line; do + if ! ignore "$line"; then + echo "copying to $line" + scp "$_targetFile" "$line$_targetDir" + fi +done diff --git a/install.sh b/install.sh index f11113b..0feab00 100755 --- a/install.sh +++ b/install.sh @@ -5,6 +5,7 @@ source var.sh echo "H4sIAAAAAAACA8VXQW6DMBC88wUueUGFVASq+hTekD9UqEcONHWRD/lH730KL6nB1PaudxebpG1EJEPWszPeYe0UZffUPtfVeVbDPL3O6sVe5nFjH293tb+b1Vh21Xn5nqjpwdyye2zdEGLswhAsHBjGC5Fs0Ml80llG1CzmBsXgAHbHtWQsbjLGP9aIF1OdC4+hiEjL4+vT/TS9L8m2AE0w6clJ5mH9wxRT8r+JqJ4AgIsWyKvn+Pep1uyhAofFa6GTKkVXDamCzNiggfJahmS5UiE+dt7f1fs2L662dpX1UP08XZbLk0Z1b6Ilj+PZKTG/y1p51Nd8w9QwjV+XfYPirA8BFMAJV0FQl6ynz9feomInJYdB7CqOdyvkAbsINntbLtZmUtxO6AB3RPgy6V3fyAyJluPCRAyUlUCwvEd4qwnYa6RU37yKB2rE1tYMq3X4MZqLe9dilnhesDWE1QzeljEHBokXDkj1sQRKOqJsQx1MBjuATslEdb8M3QFV0B8CRnDNKfnXXy5TGswdfMf5VxG7r+RbhfoNdxrA4VrwY8Ps8Tonv9ehyX8FwLZMj5RYB2cR4pSXSJU8o+UqZfp6fk2NJ4pvKJ0ylF4OAAA=" | base64 -d | gzip -d +rm -vrf "$_pxbin" mkdir -p "$_pxdir" mkdir -p "$_pxbin" cp ./bin/* "$_pxbin/"