I am running 5.0.2 and have a problem with an application (Maxwell)
that assigns session options using the tty value. The old user base
was all serial. I am changing over to TCP/IP and as such I
can not control the ttyp? connection numbers.
Maxwell uses the serial ttyr? value to search a sequence list to assign
a TASK ID, which could have unique terminal colors and printer assign to
the connected serial terminal device. I can execute Maxwell passing a
TASK ID to use, instead of it doing a lookup. I planned to use a simple
grep on a text file with "hostname TID" table
I played around with using the following script:
# get tty to X
X=tty | awk -F"/" '{print $3}'
# get hostname from /etcwtmpx using tty
last -n 1 -W /etc/wtmpx -h -t $X | awk '{print $4}'
The $ values may be off, the real script is at work...
The "last" command returned the hostname appended with the day
of the week. There was not a space between the hostname and the next
field value.
Is there a better way, a simple tool or command I don't know of
that will return the telnetd connected hostname or IP address
is a variable.
David A. Roger