Skip to content

Instantly share code, notes, and snippets.

@mcalhoun
Last active February 29, 2016 20:25
Show Gist options
  • Save mcalhoun/49d207744bac301f9fd5 to your computer and use it in GitHub Desktop.
Save mcalhoun/49d207744bac301f9fd5 to your computer and use it in GitHub Desktop.
EXCLUDEFILE=/tmp/exclude.file
EXCLUDELIST='/boot /etc/fstab /etc/hostname /etc/issue /etc/hosts /etc/sudoers /etc/networks /etc/network/* /etc/resolv.conf /etc/ssh/* /etc/sysctl.conf /etc/mtab /etc/udev/rules.d/* /lock /net /tmp /var/cache/xenstore /opt/nimsoft'
EXCLUDEPATH=$(echo $EXCLUDELIST | sed 's/\ /\\n/g')
echo -e $EXCLUDEPATH > $EXCLUDEFILE
service apache2 stop
service activemq stop
service mysql stop
service mongod stop
service tomee stop
TARGETVM="X.X.X.X"
rsync -e "ssh" -rlpEAXogDtSzh -P -x --exclude-from="$EXCLUDEFILE" --rsync-path="sudo rsync" --verbose --progress / root@$TARGETVM:/
rsync -e "ssh" -crlpEAXogDtSzh -P -x --exclude-from="$EXCLUDEFILE" --rsync-path="sudo rsync" --verbose --progress / root@$TARGETVM:/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment