Fix: scp-to-all-nodes
This commit is contained in:
parent
fe9d2e737d
commit
892a953ce6
@ -1,9 +1,21 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
source lib.sh
|
_dir="$(dirname -- "$0")/.."
|
||||||
|
_lib="$_dir/lib.sh"
|
||||||
|
_var="$_dir/var.sh"
|
||||||
|
|
||||||
|
source "$_lib"
|
||||||
|
source "$_var"
|
||||||
|
|
||||||
|
_recursive=false
|
||||||
|
|
||||||
|
if [[ "$1" == "-r" ]]; then
|
||||||
|
_recursive=true
|
||||||
|
_targetFile="$2"
|
||||||
|
else
|
||||||
_targetFile="$1"
|
_targetFile="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
if ! [[ -f "$_targetFile" ]]; then
|
if ! [[ -f "$_targetFile" ]]; then
|
||||||
echo -n "file not found: $1"
|
echo -n "file not found: $1"
|
||||||
@ -27,6 +39,10 @@ echo "'"
|
|||||||
get-targets | while read -r line; do
|
get-targets | while read -r line; do
|
||||||
if ! ignore "$line"; then
|
if ! ignore "$line"; then
|
||||||
echo "copying to $line"
|
echo "copying to $line"
|
||||||
|
if $_recursive; then
|
||||||
|
scp -r "$_targetFile" "$line$_targetDir"
|
||||||
|
else
|
||||||
scp "$_targetFile" "$line$_targetDir"
|
scp "$_targetFile" "$line$_targetDir"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user