Skip to content

Instantly share code, notes, and snippets.

@abackstrom
Created May 12, 2011 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abackstrom/968749 to your computer and use it in GitHub Desktop.
Save abackstrom/968749 to your computer and use it in GitHub Desktop.
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