xref: /plan9/sys/src/cmd/venti/words/dumpvacroots (revision 1ceb2f96de3aa60234067931ea881eab755ff021)
1#!/bin/rc
2# dumpvacroots - dumps all the vac scores ever stored to the venti server
3# if nothing else, this illustrates that you have to control access
4# to the physical disks storing the archive!
5
6ventihttp=`{
7	echo $venti | sed 's/^[a-z]+!([0-9\.]+)![a-z0-9]+$/\1/
8		s/^[a-z]+!([0-9\.]+)/\1/; s/$/:8000/'
9}
10
11hget http://$ventihttp/index |
12	awk '
13 		/^index=/ { blockSize = 0 + substr($3, 11) }
14 		/^arena=/ { arena = substr($1, 7) }
15 		/^	arena=/ {
16			start = (0 + substr($5, 2)) - blockSize
17			printf("venti/printarena -o %.0f %s\n", start, $3 "")
18		}
19	' |
20	rc |
21	awk '$3 == 16 { printf("vac:%s\n", $2 "") }'
22