Add net/scp.sh for easier file transfer to/from network nodes

This commit is contained in:
Michael Vines 2018-11-11 07:55:40 -08:00
parent 4d98da44e3
commit c07d09c011
2 changed files with 46 additions and 0 deletions

43
net/scp.sh Executable file
View File

@ -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

View File

@ -65,5 +65,8 @@ else
printNode client "$ipAddress"
done
fi
echo
echo "Use |scp.sh| to transfer files to and from nodes"
echo
exit 0