Created
February 12, 2015 14:50
-
-
Save akloboucnik/64744f3e4f202f9afd51 to your computer and use it in GitHub Desktop.
Upload to instance
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
#!/bin/bash | |
# use to upload files in opt common to instance | |
# to usage with fswatch tool use like this: | |
# - copy to repository root | |
# - run: fswatch -0 . | xargs -0 -n1 -I {} ./uploadToInstance.sh {} akl-aa | |
# | |
# $1 - path to changed file | |
# $2 - instance hostname | |
# remove afplay part if not on mac | |
PWD=`pwd` | |
SOURCEFILE=$(echo $1 | sed "s_$PWD/__") | |
USER=${FREEIPA_USER:-`whoami`} | |
echo -n "$SOURCEFILE -> $USER@$2:/opt/common" | |
tar -c $SOURCEFILE \ | |
| ssh $USER@$2 "sudo tar -x --no-same-owner -P -C /opt/common" && | |
afplay "/System/Library/Sounds/Purr.aiff" && echo " ✓" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment