/[sysadmin-cookbook]/recepies/zfs/pull-snapshot-backup.sh
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /recepies/zfs/pull-snapshot-backup.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 242 - (show annotations)
Sun Feb 13 19:39:00 2011 UTC (11 years, 3 months ago) by dpavlin
File MIME type: application/x-sh
File size: 941 byte(s)
remove function bash-isam
1 #!/bin/sh -x
2
3 # prod.vbz.ffzg.hr
4 from=10.60.0.200
5 vg=/dev/raid5
6
7 date=`date +%Y-%m-%d`
8 pool=`zpool list -o name -H`
9 log=/$pool/log/
10 exclude='--exclude var/cache --exclude var/lib/koha/zebradb/biblios --exclude data/webpac2/var/ --exclude tmp/'
11
12 test -d $log || mkdir $log || exit
13
14 rsync_veid() {
15 ssh $from "umount /mnt/backup/$2 ; lvremove -f $vg/$2-backup"
16 ssh $from "sync && sync && lvcreate -s -L 10G -n $2-backup $vg/$2 && mount $vg/$2-backup /mnt/backup/$2" || exit
17 test -d /$pool/backup/$1 || zfs create $pool/backup/$1 || exit
18 echo "## rsync $1"
19 rsync $exclude -ravHz --numeric-ids --delete --force --modify-window=2 $from::mnt/backup/$2/rootfs/ /$pool/backup/$1/ && zfs snapshot $pool/backup/$1@$date
20 # ssh $from "umount /mnt/backup/$2 && lvremove -f $vg/$2-backup"
21 }
22
23 (
24 zfs list -r $pool/backup
25 rsync_veid 212226 koha
26 rsync_veid 212052 koha-dev
27 rsync_veid 212056 webpac2
28 zfs list -r $pool/backup
29 2>&1 ) | tee -a $log/$date.log

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26