Thanks for the many responses. The answer seems to be "compare the date
of the read/write copy with those of the readonly copies".
I enclose the resulting perl script in case anyone is interested.
-Rick
|Rick Cochran 607-255-7223 [EMAIL PROTECTED]|
|Cornell Materials Science Center [EMAIL PROTECTED]|
|E20 Clark Hall, Ithaca, N.Y. 14853 cornell!msc.cornell.edu!rick|
----------------------------------------------------------------------
#!/usr/local/bin/perl
# volume_mgr - perform daily AFS volume maintenance
# 3/9/93 rcc - initial coding
# Convert date/time format in "vos exa" commands to unix time
sub gettimes {
local($vol) = @_;
local(@times);
open(zz, "vos exa $vol -localauth |") || die "unable to execute 'vos exa'\n";
while ( <zz> ) {
chop;
if ( /Last Update (.*)/ ) {
($dow, $mnth, $day, $hr, $min, $sec, $yr) = $1 =~
/^(\w+)\s+(\w+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+19(\d+)$/;
push(@times, &timelocal(($sec, $min, $hr, $day, $month{$mnth}, $yr)));
}
}
@times;
}
# Determine if an AFS volume needs to be released by comparing date of
# read/write copy with dates of readonly copies.
sub changed {
local($vol) = @_;
local(($rwdate)) = &gettimes($vol);
local(@rotimes) = &gettimes("$vol.readonly");
local($rodate);
foreach $rodate (@rotimes) {
return 1 if $rwdate > $rodate;
}
return 0;
}
# Release a volume if it needs to be released.
sub release {
local($vol) = @_;
if ( &changed($vol) ) {
print "Releasing volume $vol\n";
system("vos release $vol -localauth");
}
else {
print "$vol does not need to be released\n";
}
}
# initialization
require "timelocal.pl";
%month = ( 'Jan', 0, 'Feb', 1, 'Mar', 2, 'Apr', 3, 'May', 4, 'Jun', 5,
'Jul', 6, 'Aug', 7, 'Sep', 8, 'Oct', 9, 'Nov', 10, 'Dec', 11 );
# release some volumes
&release('rs_aix32.local.pub');
&release('rs_aix32.pub.tools');