[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-users] Location of IP file



Here's a script that displays its information...
Start here....>
#!/usr/bin/perl
print "Content-type: text/html\n\n";
system "/sbin/ifconfig | grep 'inet addr' | cut -f 2 -d':' | cut -f 1 -d' '
> list.dat";
open (LIST,'list.dat');
while(<LIST>){
 chomp($_);
 ($Field1,$Field2,$Field3,$Field4)=split(/\./,$_);
 $IPList[$i]=$Field4;
 $i++;
}
close(LIST);
@SortedIPList=sort bynumber @IPList;
print "IP List<br>Available Inet Addresses are in <font
color='red'>Red</font><br>";
$First=1;
for ($i=0;$i<=$#SortedIPList;$i++){
	if ($SortedIPList[$i] >$ARGV[0] && $SortedIPList[$i] >
$SortedIPList[$i-1]+1){
		print "<font color='red'><b>Inet Addr: $Field1.$Field2.$Field3.";
		print $SortedIPList[$i-1]+1;
		print "</font></b><br>";
		$First=0;
	}
	print "Inet Addr: $Field1.$Field2.$Field3.$SortedIPList[$i]<br>";
}

print "<br><b>Last Inet Address in use is
$Field1.$Field2.$Field3.$SortedIPList[$#SortedIPList]<br>All done<br></b>	";

sub bynumber{
	$a<=> $b;
}

<...End here
Note. all lines end with either a ';' '{' or '}'
They may get wrapped (well it is christmas) in transit.

Paul

> Subject: [cobalt-users] Location of IP file
>
>
> Hi list,
>
> Can anyone tell me the location of the file containing the list
> of IPs on a
> Cobalt RaQ?
>
> Cheers,
>              Dave