Plan 9 from Bell Labs’s /usr/web/sources/contrib/maht/rc/vbackup

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/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

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].