Revision 196, 0.8 kB
(checked in by broder, 14 years ago)
|
Fix the path to CellServDB in update-cellservdb.
|
- Property svn:executable set to
*
|
Line | |
---|
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, '<', '/var/db/openafs/etc/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 |
} |
---|