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

Tuesday 17 August 2010

Backing up Venti

This code cycles through the arenas and if it's not sealed, dump it to dvd formatted iso

#!/usr/local/plan9/bin/rc

path=(/usr/local/plan9/bin $path)
cd /home/venti/dumps

fn arenas {
wget -O - -q http://127.0.0.1:808/index | awk '
BEGIN { FS=" | |="}
/^arena/ { printf "%s", $2}
$2 == "score" { printf " %s", $3 }
$2 == "indexed:" { printf "\n" }
'
}

fn extract {
venti/rdarena /home/venti/arenas $1 | gpg --homedir /home/maht/.gnupg -e -r maht@maht0x0r.net > $1/$2
mkisofs -udf -o $1.$2.iso $1
}

fn process_arenas {
ifs = '
'
for(a in `{arenas}) {
ifs=' '
i = `{echo -n $a}
mkdir $i(1)
if(~ $#i 2) {
rm -f $i(1) ^.unsealed.iso
if(! test -e $i(1) ^. ^$i(2) ^.iso)
extract $i(1) $i(2)

}
if not {
extract $i(1) unsealed
}
rm -rf $i(1)
}
}

process_arenas

No comments: