Skip to content

Instantly share code, notes, and snippets.

@mattattui
Created January 5, 2013 09:48
Show Gist options
  • Save mattattui/4460787 to your computer and use it in GitHub Desktop.
Save mattattui/4460787 to your computer and use it in GitHub Desktop.
Simple default-safe rsync deployment script
#!/bin/bash
# Will add --dry-run unless the --go option is set. All other arguments passed to rsync (e.g. --delete)
SOURCE=.
DEST=example.com:/var/www/mysite
DRYRUN="--dry-run"
args=()
for var in "$@"
do
if [ $var == "--go" ]
then
DRYRUN=""
else
args=( "${args[@]}" "$var" )
fi
done
/usr/bin/env rsync -azCcO --force --progress --exclude-from=rsync_exclude.txt $DRYRUN "${args[@]}" "$SOURCE" "$DEST"
@mattattui
Copy link
Author

Obviously this is for relatively simple deployments. At the other end of the scale, Capifony is a powerful Ruby-based configurable solution for managing Symfony & Symfony2 deployments to multiple servers and can do stuff like provide atomic, reversible deployments, and run scripts (like database migrations, Composer update, or your test suite). If that's too complicated and this script is too simple, Anchour may suit you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment