=== modified file 'post' --- post 2014-02-18 10:33:38 +0000 +++ post 2014-02-18 09:54:08 +0000 @@ -2,6 +2,12 @@ exec 1>&2 env | grep RSYNC +# for n in $(seq 5); do +# print $n... +# sleep 1 +# done +# print 'Done!' + set -x [[ $RSYNC_MODULE_NAME != 'snaprep_new' ]] && exit 0 @@ -17,7 +23,15 @@ if [[ -a $d/.snapshot.$ts ]]; then rm -rf $f || exit $? else - rsync -aA --exclude=/.snapshot.\* --link-dest=$RSYNC_MODULE_PATH/ $RSYNC_MODULE_PATH/ $d/$ts/ || exit $? + rsync -a --exclude=/.snapshot.\* --link-dest=$RSYNC_MODULE_PATH/ $RSYNC_MODULE_PATH/ $d/$ts/ || exit $? mv $f $d/ || exit $? fi fi + +#marks=( $RSYNC_MODULE_PATH/.snapshot.[1-9]*(N) ) +#if (($#marks)); then +# mark=$marks[1] +# dst=${RSYNC_MODULE_PATH:h}/${mark##*.snapshot.} +# [[ -e $dst ]] && exit 1 +# mv -v $RSYNC_MODULE_PATH $dst +#fi === modified file 'pre' --- pre 2014-02-18 10:33:38 +0000 +++ pre 2014-02-18 09:54:08 +0000 @@ -7,3 +7,13 @@ f=( $RSYNC_MODULE_PATH/.snapshot.[0-9]*(N) ) if (($#f)); then $0:h/post; fi + +#if ! [[ -d $RSYNC_MODULE_PATH ]]; then +# snapshots=( ${RSYNC_MODULE_PATH:h}/[1-9]*(N) ) +# if (($#snapshots)); then +# src=$snapshots[-1] +# rsync -a --exclude=/.snapshot.\* --link-dest=$src $src/ $RSYNC_MODULE_PATH/ || exit $? +# else +# mkdir -p $RSYNC_MODULE_PATH/ || exit $? +# fi +#fi === modified file 'snap.push.single' --- snap.push.single 2014-02-18 10:33:38 +0000 +++ snap.push.single 2014-02-18 09:54:08 +0000 @@ -1,33 +1,5 @@ #!/bin/zsh -die() { - print -r - "$@" - exit 1 -} - -if [[ -z $SNAP_SRC ]]; then - SNAP_SRC=$1;shift -fi -if [[ -z $SNAP_DST ]]; then - SNAP_DST=$1;shift -fi - -marks=( $SNAP_SRC/.snapshot.[0-9]*(N) ) -(( $#marks != 1 )) && die invalid marks ${(qqq)marks} - -if [[ $SNAP_DST == *:* ]]; then - # remote - rsync -aA --delete "$@" --exclude=/.snapshot.\* $SNAP_SRC/ $SNAP_DST/ && \ - rsync -aA --delete "$@" $SNAP_SRC/ $SNAP_DST/ -else - # local - [[ -d $SNAP_DST ]] || die destination not a directory: ${(qqq)SNAP_DST} - ts=${f##*.} - snapshots=( ${SNAP_DST}/.snapshot.[1-9]*(N) ) - if (($#snapshots)); then - link=${SNAP_DST}/${${snapshots[-1]}##*.} - rsync -aA --link-dest=$link "$@" $SNAP_SRC/ $SNAP_DST/$ts/ || exit $? - else - rsync -aA "$@" $SNAP_SRC/ $SNAP_DST/$ts/ || exit $? - fi - touch ${SNAP_DST}/$marks:t -fi +src=$1;shift +dst=$1;shift +rsync -a --delete "$@" --exclude=/.snapshot.\* $src/ $dst/ && \ +rsync -a --delete "$@" $src/ $dst/ === modified file 'snapshot.lvm2' --- snapshot.lvm2 2014-02-18 10:33:38 +0000 +++ snapshot.lvm2 2013-10-25 18:35:49 +0000 @@ -30,9 +30,6 @@ exit $? } mount "$S_DEV" "$SNAPSHOT" || die_lvremove $? -SNAP_SRC=$SNAPSHOT -export SNAP_SRC -touch $SNAP_SRC/.snapshot.$(date +%s) "$@" RETCODE=$? umount "$SNAPSHOT"