Created
May 12, 2011 15:28
-
-
Save abackstrom/968749 to your computer and use it in GitHub Desktop.
Script to reset staging server to production state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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