#!/bin/rc # progressively replicates venti datablocks # ventibackup [-p prepfile] [-f infofile] [ventihttp_dialstring] rfork e infofile=bkup.info while (~ $1 -*){ switch($1){ case -f infofile = $2 shift shift case -p prepfile = $2 shift shift case * echo bad flag $1 >[1=2] exit bad.flag } } mypid=$pid venticall = $1 if(~ $venticall '') venticall = 'http://127.1:8000/index' if(~ $# prepfile 1) . $prepfile . $infofile fn x { echo x $* y=$1 if(~ $#$y 0){ $y=0 } echo venti/wrarena -o $2 $3 $$y end=`{venti/wrarena -o $2 $3 $$y | grep '^end offset ' | sed 's/^end offset //'} if(~ $#end 1 && ! ~ $$y $end){ $y=$end echo '#' `{date} >>$infofile whatis $y >>$infofile } } hget $venticall | awk ' /^index=/ { blockSize=0+substr($3, 11); } /^arena=/ { arena=substr($1, 7); } /^ arena=/ { printf("x %s %s %s\n", arena, substr($5 ,2), $3); } ' | sed 's/\,.*\)//g' >/tmp/offsetparse numarenas=`{wc /tmp/offsetparse} count=0 while(! ~ $count $numarenas(1)){ data = `{grep arenas^$count /tmp/offsetparse} offset=`{echo $data(3) ' - 8192' |pc |sed 's/;//g'} echo x $data(2) $offset $data(4) >>/tmp/offsets.$mypid count=`{echo $count ' + 1' |hoc} } cat /tmp/offsets.$mypid |rc rm /tmp/offsets.$mypid