- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how do you distinguish between connection type...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2002 10:47 PM
07-14-2002 10:47 PM
how do you distinguish between connection types? When I connect to a HPUX machine through various means (telnet, dtterm, xterm (local&remote), console) I want to be able to recognize each possible type of connection in /etc/profile to provide the right environment for that type of connection. When I run 'who', I see various types (console, pts/n, dtremote, pts/tx, ttynpn) but I couldn't find documentation on how to test on these, nor what each is, though console obviously is a serial connection.
Thanks for any insight in this.
Sincerely,
Jan de Haan.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2002 11:10 PM
07-14-2002 11:10 PM
Re: how do you distinguish between connection types?
console = console
telnet = pts/NN (number is in hex)
terminal/modem = tty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2002 11:23 PM
07-14-2002 11:23 PM
Re: how do you distinguish between connection types?
you're right in your assignments, but what I really like to know is how to test for them in the various login scripts (/etc/profile, .dtprofile etc.)
Thanks for your fast reply.
Jan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2002 11:06 AM
07-15-2002 11:06 AM
Solutionnot .profile.
pty -s will set the return code to indicated if you
are on a pseudo-terminal.
If you are you have a dtterm or xterm connection. You
may be able to determine
which by looking at the
$TERM variable.
The command
ps | tail -1 | awk '{print $2}'
will return the device
you are connected on.
You can case on this to determine console, tty, pty.
tty -s will set the return
code to indicate if you
are on a terminal. Use this
to determin if you are running
in batch mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2002 12:40 PM
07-15-2002 12:40 PM
Re: how do you distinguish between connection types?
You could use `lssf $(tty)` to determine the driver used by the device. Please note that tty also works for pty devices, but not the other way around. Take a look at the differences:
From a C3600 running HPUX 11.00 64-bit June 2002:
$ lssf /dev/console /dev/ttyp0 /dev/pts/1 /dev/pts/t1
pseudo driver cn minor 0x000000 /dev/console
pseudo driver ptys minor 0x000000 /dev/ttyp0
pseudo driver pts minor 0x000001 /dev/pts/1
pseudo driver tels minor 0x000034 /dev/pts/t1
We know the console is on the cn device and that other hardwired terminals are ptys devices. We also know that a telnet session grabs a tels device. But it gets tricky with ssh, rlogin, xterm, etc which all use pts devices (and sometimes ptys).
I may comment more later. Until then, I hope you find others' remarks more useful.