#!/bin/rc
if(! ~ $#* 2) {
status = 'usage: vbackup arenasbasepath backuppath # i.e. vbackup /dev/sdC0 /n/kremvax/moscov/arenas' > /fd/2
exit
}
cd $2 || status=$2 ^' not found' && exit
! test -w $1/arenas && status=$1 ^'/arenas permissison denied, perhaps you are not the hostowner' && exit
rfork e
echo `{date -n} `{fossil/last $1/fossil} >> vacs
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
}
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
|