Skip to content

Instantly share code, notes, and snippets.

@xaptronic
Created March 8, 2012 19:14
Show Gist options
  • Save xaptronic/2002780 to your computer and use it in GitHub Desktop.
Save xaptronic/2002780 to your computer and use it in GitHub Desktop.
symfony remote sync
REMOTE=$1
rsync_extra=$2
if [ -z "$REMOTE" ]; then
echo "Usage: sf_sync <sync_to> (what environment)"
echo "Syncs changes made to the current directory tree to <sync_to>"
echo "E.g.; alex@hactar ~/dev/trunk $ sf_sync local"
echo "Files in the current directory tree (~/dev/trunk) will be automatically pushed to tpweb:code/trunk whenever a change is made."
exit 1;
fi
sf_root=`pwd`
[ ! -e $sf_root/symfony ] && echo "Make sure you run this in a symfony 1.x root dir" && exit;
while inotifywait -q -q -r -e modify $sf_root;
do
echo "syncing changes..." `date +%k:%M:%S.%N`;
rsync -rlzCc --force --delete $rsync_extra \
--exclude-from=$sf_root/config/rsync_exclude.txt \
$sf_root/* $REMOTE;
echo "completed..." `date +%k:%M:%S.%N`;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment