Well, since our remote news machine's disk is full and I cannot post
this to USENET, the list gets it first.
Let me know if you use this and like it.
Also let me know if this is an inappropriate post for this list.
I figured, "It's tiny, so it can't hurt too bad."
This is not a sh-archive (shar). Save this file, edit it to make sure
none of the long lines have been broken into two lines, change the
location of Perl if you need to, chmod 755 the file, run it.
#!/usr/local/bin/perl
#
# Copyright (c) Jeff Blaine 1994 <[EMAIL PROTECTED]>
# This script may be distributed freely without modification, but may not
# be used to gain profit in any way.
#
# Remove AFS 3.x volume and its mount point given just the mount point
# Usage: vrm mount_point
#
# Version below
# $Id: vrm,v 1.1 1994/08/20 22:11:29 jblaine Exp $
if ($ARGV[0] eq "") {
&usage;
}
foreach $dir (@ARGV) {
open (FSLSM, "fs lsmount $dir |");
$line = <FSLSM>;
close (FSLSM);
$line =~ /#(.*)'/;
$vol_ID = $1;
print "The volume ID is: $vol_ID\n";
open (VOSEXA, "vos exa $vol_ID |");
while (<VOSEXA>) {
$line = $_;
if ($line =~ /^\s+server\s+(.*)\s+partition\s+(.*)\s+RW.+/) {
$server = $1;
$partition = $2;
last;
}
}
close (VOSEXA);
if (!$server || !$partition) {
print "Could not gather information from \"vos exa \" properly.\n";
exit;
}
print "Deleting $vol_ID from $server $partition\n";
system ("vos remove -server $server -partition $partition -id $vol_ID");
print "Removing mount point: $dir\n";
system ("fs rmmount $dir");
}
sub usage {
print STDERR "Usage: $0 mount_point\n";
print STDERR " Removes volume mounted at mount_point and the mount_point
itself.\n";
exit;
}