Revision 79

Date:
2009/05/17 12:45:11
Author:
dpavlin
Revision Log:
extract rsync into function
Files:

Legend:

 
Added
 
Removed
 
Modified
  • recepies/zfs/pull-snapshot-backup.sh

     
    5 5 pool=opl
    6 6 log=/$pool/log/
    7 7
    8 function rsync_veid() {
    9 rsync -ravHC --numeric-ids --delete --force --modify-window=2 $from:/mnt/vz-backup/private/$1/ /$pool/backup/$1/ && zfs snapshot $pool/backup/$1@$date
    10 }
    11
    8 12 (
    9 zfs list -r $pool/backup | tee $log/zfs-list.before
    13 zfs list -r $pool/backup
    10 14 ssh $from 'sync && sync && lvcreate -s -L 10G -n vz-backup /dev/vg/vz && mount /dev/vg/vz-backup /mnt/vz-backup/' || exit
    11 rsync -ravHC --numeric-ids --delete $from:/mnt/vz-backup/private/212226/ /$pool/backup/212226/ && zfs snapshot $pool/backup/212226@$date
    12 rsync -ravHC --numeric-ids --delete $from:/mnt/vz-backup/private/212052/ /$pool/backup/212052/ && zfs snapshot $pool/backup/212052@$date
    15 rsync_veid 212226
    16 rsync_veid 212052
    13 17 ssh $from 'umount /mnt/vz-backup/ && lvremove -f /dev/vg/vz-backup'
    14 zfs list -r $pool/backup | tee $log/zfs-list.after
    15 ) | tee $log/$0.$date.log
    18 zfs list -r $pool/backup
    19 2>&1 ) | tee -a $log/$date.log