Skip to content

Instantly share code, notes, and snippets.

@abackstrom
Created May 12, 2011
Embed
What would you like to do?
Script to reset staging server to production state
#!/bin/sh
function do_rsync {
rsync -avzP --delete "server:$1" "$1"
}
echo -n 'Are you really sure? [y/N] '
read response
if [ "$response" != "y" -a "$response" != "Y" ] ; then
echo "Cancelled by user."
exit 1
fi
# Default directories, if no arguments were provided
if [ -z "$1" ] ; then
do_rsync /web/includes/
do_rsync /web/html/
exit
fi
# User provided specific directories; iterate over them
while [ ! -z "$1" ]; do
do_rsync "$1"
shift
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment