summaryrefslogtreecommitdiff
path: root/scripts/priority.pl
blob: 59239bfe614efcbb00266e7926541825a6c7f5e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl

my %pri;

    # first check if this file exists, and if so ensure this is a config file.
my @files = `find /opt/vyatta/share/vyatta-cfg -name 'node.def'`;
foreach my $f (@files) {
    my $result = `grep 'priority:' $f`;
   if (defined $result && length($result) != 0) {
       my @r = split " ", $result;
       if (defined $r[1]) {
	   #stuff in hash here
	   push @{$pri{$r[1]}},$f;
       }
    }
}


#now sort

foreach my $key ( sort { $a <=> $b } keys %pri ) {
    my @a = @{$pri{$key}};
    foreach my $val (@a) {
	my $loc = substr($val,0,-10);
	my $loc = substr($loc,39);
	print $key," ",$loc,"\n";
    }
}