Re: Fixed BBX Terminal numbers with pseudo ttys
From: Michel Donais (donais@gsig-net.qc.ca)
Date: 04/17/03
- Next message: Jean-Pierre Radley: "Re: Fixed BBX Terminal numbers with pseudo ttys"
- Previous message: Jean-Pierre Radley: "gatewaying mail to newsgroups"
- In reply to: Danny Aldham: "Fixed BBX Terminal numbers with pseudo ttys"
- Next in thread: Jean-Pierre Radley: "Re: Fixed BBX Terminal numbers with pseudo ttys"
- Reply: Jean-Pierre Radley: "Re: Fixed BBX Terminal numbers with pseudo ttys"
- Reply: Jean-Pierre Radley: "Re: Fixed BBX Terminal numbers with pseudo ttys"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Michel Donais" <donais@gsig-net.qc.ca> Date: Wed, 16 Apr 2003 23:44:55 -0400
Hi Danny,
I was in the same bath last year.
If you upgrade to SCO 5.0.6 there is a function called 'seval' witch can do
what you want.
but if an upgrade is not affordable as for me then:
I found some answers from the list last year.
Take at the following it may be a solution for you.
------------------------------------------------------------------------
Michel Donais" <donais@gsig-net.qc.ca> wrote in message
news:9pps8a$li3$1@milo.basis.com...
> We have a number of PC`S connected to a host via a lan.
>
> Each time a PC login at the host a pseudo tty adress is assigned to the
> connection. Iwant to get fixed adresses so that
>
> T1 always connect to /dev/ttys01
> and so for others stations
>
> Michel
I've got a solution that gives a fixed set of terminal IDs to a specific
user. It's login name specific, rather than workstation specific, but works
well for me.
/usr/bin/bbxgo
#!/bin/sh
# Assign users specific terminals
pid=$$
tid=`cat $HOME/.bbterm`
tty=`tty`
# Search for an unlocked TTY id. Note that I've limited my users
# to 10 simultaneous sessions. You may choose a smaller number.
# The file .bbterm in the users home directory contains the basic
# terminal ID that they will have. If it contains "T01" the user
# will get a terminal ID ranging from "T010" to "T019"
num=0
avail=-1
while [ ${avail} = -1 -a ${num} -lt 10 ]
do
if [ -f ${HOME}/LCK..${tid}${num} ]
then
num=`expr ${num} + 1`
else
avail=${num}
fi
done
if [ ${avail} = -1 ]
then
# This section will startch checking the PIDs in the lockfile
# And find one where the PID is no longer in use. This will
# vary depending on the OS that you use. I'm not going to
# give you my code, because it's not very pretty. :-)
else
echo ${pid} >> ${HOME}/LCK..${tid}${avail}
fi
# The config.stub contains the setopts, stblen, common printers,
# and other configuration information that remains static.
cat /usr/bbx/config.stub > ${HOME}/config.bbx
echo "alias ${tid}${avail} ${tty} scoansi" >> ${HOME}/config.bbx
BBCONFIG=${HOME}/config.bbx
TERMCAP=/usr/bbx/termcap
export BBCONFIG TERMCAP
# Your command line may vary. I've stripped out the various options,
# and the startup program that I run, as it may not be of use to you.
/usr/bbx/pro5
# Clean up the lockfile
rm ${HOME}/LCK..${tid}${avail}
----------------------------------------------------------------------------
-
>The scripts and advice I have received so far are excellent, except for
>the fact that they all require (as far as I can tell) the IP address or
>machine hostname to only log in once. If they log in again from the same
>IP address or hostname, a duplicate BBTERM will be used.
>
I use a system that assigns based on ttyp number so that each BBTERM is
unique...I use a file (term.pro5) that is in this format
ttypxx<tab>TXX<tab>LXX
Jesus Alvarez uses a math algorithm instead you might like bettter... I add
the Terminal & slave printer to a "standard config.pro5 file" that has
common printers in it.
here is my script pro5.start (that calls tty_id below):
#
#assign in case not in file
BBTERM=T99
BBSLAVE=L99
#rem assign FID(0) based on tty
ttyname=`tty`
ttyname1=\/$ttyname
rm /tmp$ttyname > /dev/null 2>/dev/null
usrname=`logname`
awk -f /usr/bin/tty_id /usr/basis/pro5/term.pro5
. /tmp$ttyname
cat /usr/basis/pro5/config.pro5 > /tmp$ttyname
TRASH="alias "$BBTERM" "$ttyname" term"
echo $TRASH >> /tmp$ttyname
#set up slaves
if [ `expr $TERM : "ansi"` -gt "0" ]
then
TRASH="alias "$BBSLAVE" "$ttyname1" \""$usrname"\" cr,slon=1b5b3569
,sloff=1b5b3469,CPCOLS=255,SPCOLS=255"
echo $TRASH >> /tmp$ttyname
fi
if [ `expr $TERM : "wy60"` -gt "0" ]
then
TRASH="alias "$BBSLAVE" "$ttyname1" \""$usrname"\"
cr,slon=1b6423,sloff=14,CPCOL
S=255,SPCOLS=255"
echo $TRASH >> /tmp$ttyname
fi
if [ `expr $TERM : "4313"` -gt "0" ]
then
TRASH="alias "$BBSLAVE" "$ttyname1" \""$usrname"\"
cr,slon=1b41,sloff=1b42,CPCOL
S=255,SPCOLS=255"
echo $TRASH >> /tmp$ttyname
fi
#do the do
env TERMCAP=/usr/basis/pro5/termcap
usr/basis/pro5/pro5 -q -m512 -c/tmp$ttyname /usr2/pgm/MAIN -
#clean up
rm /tmp$ttyname >/dev/null 2>/dev/null
-------------------------------------------------------------------------
here is tty_id
BEGIN{ FS= OFS = "\t"
i=1
xx="BBTERM"
yy="BBSLAVE"
"tty" | getline ttynam}
{while
getline $0
if
print xx "=" $1 "; export " xx > ("/tmp" $2)
print yy "=" $3 "; export " yy >> ("/tmp" $2)
i=0
exit
}
}
}
----------------------------------------------------------------------------
------------
It appears lots of people encounter this situation!
The scripts and advice I have received so far are excellent, except for
the fact that they all require (as far as I can tell) the IP address or
machine hostname to only log in once. If they log in again from the same
IP address or hostname, a duplicate BBTERM will be used.
In fact, 50% of my folks will be loggin in from a common machine (terminal
server), so they will all have the same IP address/hostname.
To remedy this situation, all I can think of doing is have the startup
script check an enviroment var (TERMLOC) and set the BBTERM accordingly.
TERMLOC could be determined by the terminal server and passed as
a TERM value (set a bogus term type and parse it in /etc/profile).
Does this sound reasonable?
THanks again for all the responses!
Rick Mills
Frank Anderson <franka@azstarnet.com> wrote:
: We execute the following script on login. It looks up the IP address in
: a file named "aliastable" and assigns a corresponding Tx value.
: PSD=`tty |cut -c6-`
: PIP=`who -x | grep $PSD' ' |cut -c38-`,
: # not on a tcp/ip port, then exit
: if [ "$PIP" != "," ]
: then
: aliases=`cat aliastable|grep $PIP|cut -d, -f 2`
: for i in $aliases
: do
: P=`ps -ef|grep bbx4|grep t$i' '`
: if [ "$P" = "" ]
: then
: BBT=$i
: break
: fi
: done
: if [ "$BBT" = "" ]
: then
: echo "NO sessions available for address $PIP"
: echo "Return to exit:\c"
: read q
: exit
: else
: BBTERM=$BBT
: export BBTERM
: fi
: fi
: The aliastable file just has IP address a comma and Tx value. If who -x
: returns a machine name instead of an IP name, we use that in the
: aliastable. This is on an SCO system.
----------------------------------------------------------------------------
--- We execute the following script on login. It looks up the IP address in a file named "aliastable" and assigns a corresponding Tx value. PSD=`tty |cut -c6-` PIP=`who -x | grep $PSD' ' |cut -c38-`, # not on a tcp/ip port, then exit if [ "$PIP" != "," ] then aliases=`cat aliastable|grep $PIP|cut -d, -f 2` for i in $aliases do P=`ps -ef|grep bbx4|grep t$i' '` if [ "$P" = "" ] then BBT=$i break fi done if [ "$BBT" = "" ] then echo "NO sessions available for address $PIP" echo "Return to exit:\c" read q exit else BBTERM=$BBT export BBTERM fi fi The aliastable file just has IP address a comma and Tx value. If who -x returns a machine name instead of an IP name, we use that in the aliastable. This is on an SCO system. Rick Mills wrote: > > In a Unix setup: > > In the pro5 application we use, Open Systemss Accounting Software, > a lot of defaults for flags throughout the system are based on your > alias device, which is based on your terminl device, which in the > case of serial terminals and consoles, are static, but in the case > of people telneting in or running xterm, are dynamic. > > Has anybody come up with a solution for this? Right now my quick hack > is to set the TERM type to something unique, depending on the terminals > location, then build a config.bbx on the fly based on your current tty. > > Has someone come up with a way to determine a unique identifier for > the terminal your loggin in from, say the IP address? > > Thanks for any help!
- Next message: Jean-Pierre Radley: "Re: Fixed BBX Terminal numbers with pseudo ttys"
- Previous message: Jean-Pierre Radley: "gatewaying mail to newsgroups"
- In reply to: Danny Aldham: "Fixed BBX Terminal numbers with pseudo ttys"
- Next in thread: Jean-Pierre Radley: "Re: Fixed BBX Terminal numbers with pseudo ttys"
- Reply: Jean-Pierre Radley: "Re: Fixed BBX Terminal numbers with pseudo ttys"
- Reply: Jean-Pierre Radley: "Re: Fixed BBX Terminal numbers with pseudo ttys"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|