Bob Doolittle | 3 Aug 2010 03:56
Picon
Favicon

Re: Better way in getting DTU IP address

Be wary of doing this during session startup on large installations.

After an outage or when powering up a new installation of DTUs utauthd 
can be bombarded with connection requests and is responsible for 
starting up sessions.
If those sessions during startup wind up doing callbacks to utauthd 
(port 7010) this can overload the process and cause timeouts and 
consequent problems.

-Bob

Murray Fraser wrote:
> utwho is a script as well, have a read of /opt/SUNWut/bin/utwho
>
> essentially, if you open a tcp socket to port 7010, and send 'status',
> you will get all the information you need, and a lot more.
>
> You can use perl to put it all together (each record is between a
> 'begin' and 'end' line). I think you want the 'terminalIPA' line for
> the ip address, and 'connected=true' for connected.
>
>
>
> On Tue, Aug 3, 2010 at 1:21 AM, CJ Keist <cj.keist <at> colostate.edu> wrote:
>   
>> I'm currently trying to figure out the correct IP address for the DTU using
>> the following perl script:
>>
>> #!/usr/bin/perl
>>
>> my $line;
>> my  <at> array;
>> my $ip;
>> my $junk;
>> my $user = $ENV{USER};
>>
>> open(WHO, "/opt/SUNWut/bin/utwho -c|");
>> open(LOG, ">>/tmp/log.txt");
>> while (<WHO>) {
>>    $line = $_;
>>     <at> array = split (' +\s', $line, 5);
>>    print LOG "User: $user $array[1]\n";
>>    if ($user eq $array[1]) {
>>        ($ip, $junk) = split(' ', $array[2], 2);
>>        print LOG "IP: $ip\n";
>>        if ($ip =~ "192.168") {
>>            system("/opt/SUNWut/bin/utswitch -h 192.168.100.12");
>>        }
>>        else {
>>            system("/opt/SUNWut/bin/utswitch -h
>> sunfire5.engr.colostate.edu");
>>        }
>>        break;
>>    }
>> }
>> close(WHO);
>> close(LOG);
>>
>> The problem I'm running into is the case with the following two utwho -c out
>> lines:
>>
>>   2.0 pseudo.00144f946d3e              engr85   192.168.102.208
>> P8-FS.00144f946d3e
>> 10.0 pseudo.00144fd18d32              engr48   129.82.229.249
>>  P8-FS.00144fd18d32
>>
>> The space in the beginning of the  first utwho output is throwing my whole
>> split return in the dumps.  Just wonder if there is a better way in getting
>> the IP of the DTU you are on when running in kiosk mode?  Is the an
>> environment variable set for the IP of the DTU?
>>
>> --
>> C. J. Keist                     Email: cj.keist <at> colostate.edu
>> UNIX/Network Manager            Phone: 970-491-0630
>> Engineering Network Services    Fax:   970-491-5569
>> College of Engineering, CSU
>> Ft. Collins, CO 80523-1301
>>
>> All I want is a chance to prove 'Money can't buy happiness'
>>
>> _______________________________________________
>> SunRay-Users mailing list
>> SunRay-Users <at> filibeto.org
>> http://www.filibeto.org/mailman/listinfo/sunray-users
>>
>>     
> _______________________________________________
> SunRay-Users mailing list
> SunRay-Users <at> filibeto.org
> http://www.filibeto.org/mailman/listinfo/sunray-users
>   

Gmane