#!/bin/bash if [ `pgrep ssh-agent | wc -l` -lt 1 ] then echo "You might do well to start ssh-agent now." exit fi # let's presume that the remote snap dir is /tmp/mysql # but let it be overridden remoteSnapdir="${1:-/tmp/mysql}" cd /var/lib/mysql rsync --progress -axrve ssh \ --exclude "*bin.index" \ --exclude "*.info" \ --exclude "*-bin.0*" \ root@my01:$remoteSnapdir . find -type d -exec chmod 700 {} \; find -type f -exec chmod 600 {} \; chown -R mysql:mysql . #eof