Record of some of the computer tech I deal with so that it's documented at least somewhere.

Sunday 23 August 2009

dumping venti arenas

It's about time I dumped my venti arenas.

Here's the script I'm using to read the arenas.


#!/bin/rc

! test -w /dev/sdC0/arenas && status='not hostowner' && exit

rfork e

echo `{date -n} `{fossil/last $1/fossil} >> vacs

# sort this bit out to cd to the backup dir
9fs momo
cd /n/momo/home/t23/arenas
# in backup dir

fn do{
b=`{echo $1 | sed -e 's!/dev/!!g' -e 's!/arenas!!g'}
b=$b(1)
if(~ $#3 0)
venti/rdarena $1 $2 > $b.$2
if not
if(! test -e $b.$3)
venti/rdarena $1 $2 > $b.$2.$3 && rm -f $b
}

fossil/last >> vacs

hget http://127.1:8000/index |
awk '
/^arena=/ { arena=substr($1, 7); score=""}
/^ arena=/ { dev=$3 }
/^ score=/ { score=substr($1, 7) }
/^ written:/ { print "do " dev " " arena " " score }
' |rc


which is adapted from Russ' restore script.
I added the hostowner check and I' not sure it works so note that

next up I have to work out if the final score is checkable outside venti, i.e it could be the hash of the whole arena.

No comments: