snaprep

git mirror of https://ccx.te2000.cz/bzr/snaprep
git clone https://ccx.te2000.cz/git/snaprep
Log | Files | Refs

commit 1e01846388e1e7ff30a337b98553e39231e02cad
Author: Jan Pobrislo <ccx@webprojekty.cz>
Date:   Mon, 13 May 2013 15:47:24 +0200

initial commit
Diffstat:
Asnaprep | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/snaprep b/snaprep @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ $# -ne 2 ]; then + echo "usage: snaprep src_dir [user@]dst_host:dst_dir" +fi + +remote="${2%%:*}" +remote_basedir="${2#*:}" + +rsync_list() { + rsync --list-only --dirs "$@" | sed 's/^.......................................... //' +} +remote_snaps="$(rsync_list)" + +for local_snap in "$1"/*; do + if [ -d "$snap" ] && ! grep -qFe "$snap" <<<"$remote_snaps" ; then + ssh remote snapclone "$remote_basedir/$snap" + fi +done