Last active
August 29, 2015 14:19
-
-
Save andreychev/d127592569e57a7214d2 to your computer and use it in GitHub Desktop.
new sync
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 | |
set -u # prevent unbound variables | |
set -e # terminate on error | |
SSH_PORT=$(boot2docker config 2>&1 | awk '/SSHPort/ {print $3}') | |
# install rsync | |
boot2docker ssh tce-load -wi rsync | |
# ensure existance of .rsyncignore | |
touch .rsyncignore | |
function boot2docker_sync { | |
# sync current directory to ~/share on the vm | |
rsync \ | |
-rlz --force --delete \ | |
--exclude-from=.rsyncignore \ | |
-e "ssh \ | |
-o UserKnownHostsFile=/dev/null \ | |
-o StrictHostKeyChecking=no \ | |
-i $HOME/.ssh/id_boot2docker \ | |
-p $SSH_PORT" \ | |
./ docker@localhost:/opt/app | |
echo "sync: $(date)" | |
} | |
export -f boot2docker_sync | |
boot2docker_sync | |
fswatch -o . | xargs -n1 -I{} boot2docker_sync |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment