Skip to content

Instantly share code, notes, and snippets.

@laurentlemaire
Created June 30, 2014 07:01
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laurentlemaire/e423b4994c7452cddbd2 to your computer and use it in GitHub Desktop.
Save laurentlemaire/e423b4994c7452cddbd2 to your computer and use it in GitHub Desktop.
Vagrant rsync watcher (Mac osx)
#!/bin/sh
##
# Keep local path in sync with remote path on server.
# Ignore .git metadata.
#
local=$BASEDIR
project='projetctname'
remote='root@vagrantbox.com:/var/www/'$project
# Initialization - copy entire directory to host
if [ $1 = "init" ]; then
echo "Project Initialization"
rsync -riau ./* $remote
fi
# Watch for changes
echo "Watching for new changes..."
cd "$local" &&
fswatch . "date +%H:%M:%S && rsync -iau --exclude='.git' --exclude='.idea/*' --exclude='app/cache' --exclude='app/logs' --exclude='web/temp/xml' --exclude='web/dynamic' --exclude-from='.gitignore' --delete . $remote"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment