Revision 23739,
775 bytes
checked in by broder, 16 years ago
(diff) |
In afs-config:
* Add script to `fs newcell` any cells that are out of date according to
the newly installed CellServDB. (Trac: #186)
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[23739] | 1 | #!/usr/bin/perl |
---|
| 2 | use strict; |
---|
| 3 | use warnings; |
---|
| 4 | |
---|
| 5 | my %cm_servers; |
---|
| 6 | open(FS, '-|', 'fs', 'listcells', '-numeric') or die; |
---|
| 7 | while (<FS>) { |
---|
| 8 | if (/^Cell dynroot on hosts\.$/) { |
---|
| 9 | } elsif (/^Cell (\S+) on hosts (.+)\.$/) { |
---|
| 10 | $cm_servers{$1} = [split(' ', $2)]; |
---|
| 11 | } else { |
---|
| 12 | die; |
---|
| 13 | } |
---|
| 14 | } |
---|
| 15 | close(FS) or die; |
---|
| 16 | |
---|
| 17 | my %csdb_servers; |
---|
| 18 | my $cell; |
---|
| 19 | open(CSDB, '<', '/etc/openafs/CellServDB') or die; |
---|
| 20 | while (<CSDB>) { |
---|
| 21 | if (/^>([^#\s]+)/) { |
---|
| 22 | $cell = $1; |
---|
| 23 | } elsif (/^([^#\s]+)/) { |
---|
| 24 | push(@{$csdb_servers{$cell}}, $1); |
---|
| 25 | } else { |
---|
| 26 | die; |
---|
| 27 | } |
---|
| 28 | } |
---|
| 29 | close(CSDB); |
---|
| 30 | |
---|
| 31 | while (my ($cell, $servers) = each(%csdb_servers)) { |
---|
| 32 | if (!exists($cm_servers{$cell}) or |
---|
| 33 | join(' ', sort(@{$cm_servers{$cell}})) ne join(' ', sort(@$servers))) { |
---|
| 34 | system('fs', 'newcell', '-name', $cell, '-servers', @$servers); |
---|
| 35 | } |
---|
| 36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.