Add net/scp.sh for easier file transfer to/from network nodes
This commit is contained in:
parent
4d98da44e3
commit
c07d09c011
|
@ -0,0 +1,43 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
here=$(dirname "$0")
|
||||||
|
# shellcheck source=net/common.sh
|
||||||
|
source "$here"/common.sh
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
exitcode=0
|
||||||
|
if [[ -n "$1" ]]; then
|
||||||
|
exitcode=1
|
||||||
|
echo "Error: $*"
|
||||||
|
fi
|
||||||
|
cat <<EOF
|
||||||
|
usage: $0 source ... target
|
||||||
|
|
||||||
|
node scp - behaves like regular scp with the necessary options to
|
||||||
|
access network nodes added automatically
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit $exitcode
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts "h?" opt; do
|
||||||
|
case $opt in
|
||||||
|
h | \?)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
usage "Error: unhandled option: $opt"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
loadConfigFile
|
||||||
|
|
||||||
|
if [[ -n "$1" ]]; then
|
||||||
|
set -x
|
||||||
|
exec scp "${sshOptions[@]}" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$here"/ssh.sh
|
||||||
|
|
||||||
|
exit 0
|
|
@ -65,5 +65,8 @@ else
|
||||||
printNode client "$ipAddress"
|
printNode client "$ipAddress"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
echo
|
||||||
|
echo "Use |scp.sh| to transfer files to and from nodes"
|
||||||
|
echo
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue