which host

From: Werner Winter (werner.winter_at_asamnet.de)
Date: 10/31/03


Date: Fri, 31 Oct 2003 16:28:21 +0100

Hello,
I've setup a linux terminal server. Now I want to know, which user is logged
in on which host . So I wrote a perl-script named "which_host"

# which user
$uid=$<;
$username=(getpwuid)$uid))[0];
$username = $1;

#which host
@last= `/usr/bin/last -n 1 -a $username`;
# line 18
$host= (split (/\s+/, $last[0]))[9];

The last two lines cause an error: Use of uninitialized value in string eq
at /usr/local/bin/which_host line 18

The problem is, that "last" shows only 8 columns, no host in column 9 is
shown. If I change the line
@last= `/usr/bin/last -n 1 -a $username`;
 to
@last= `/usr/bin/last -n 3 -a $username`;
then I get 3 lines and in the third line the host is shown in column 9.

What can I do?

cu
Werner



Relevant Pages

  • Re: How to set up a MX record for Exchange?
    ... Then you do setup the MX record with buydomains.com. ... the mailserver host name would then be the FQDN that you ... My ISP just provide Internet service. ...
    (microsoft.public.windows.server.sbs)
  • Re: networking with an embedded computer (fwd)
    ... > I have a control setup that someone else set up to run. ... > Redhat for its hard drive. ... > host computer, but only have a floppy functional at this time. ... BUT I would like to set up my host to use the network. ...
    (comp.os.linux.embedded)
  • Re: Wifi network recognised but cant share Internet
    ... >I am trying to setup a similar network at our SOHO. ... I'm a little unsure what you're trying to do here, and how your network is ... And the PPP adapter on the host. ... Did you configure the wireless adapter as adhoc ...
    (microsoft.public.windowsxp.network_web)
  • Re: Cant assign IP to site
    ... was trying to do that in the first place .I never setup a site w/o a host ... Let me describe my setup. ... not even talking about SSL yet, 1 step at a time) I still get this problem. ... I have verified by checking each website properties and advanced button ...
    (microsoft.public.inetserver.iis)
  • LPP Sharing Problem
    ... I have been trying unsuccessfully to setup a Cups printer for sharing on ... I first setup that printer on this PC for sharing (any host). ...
    (Fedora)