Created
March 13, 2014 10:33
-
-
Save dobrokot/9525920 to your computer and use it in GitHub Desktop.
copy directory fron host to (local or other) host
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu | |
if [ "." == "$2" ]; then | |
CMD="tar -xvzf -"; | |
else | |
case "$2" in | |
"dev") H="kotic.dev.zla.net" ;; | |
"gen") H="kotic-gen.proto.zla.net" ;; | |
*) H="$2" ;; | |
esac | |
CMD="ssh $H 'tar -xvzf -'" | |
fi | |
echo "ssh $(hostname --fqdn) 'cd $(dirname $(readlink -f $1)) && tar -cf- $(basename $1) | gzip -1' | $CMD " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment