Hostname of where any windows is opened ?


 
Thread Tools Search this Thread
Operating Systems AIX Hostname of where any windows is opened ?
# 1  
Old 10-23-2009
Question Hostname of where any windows is opened ?

Is it possible to get the hostname of the server we are currently working on (physically) even if we have rlogged/tn to another one ?

There is this DISPLAY variable we always have to setup everytime we log to a server (anyone). It has to be set to the name of the server we are physically working on. Its a bit annoying having to do this all the time. The purpose of this variable it to use VPRINT/BPRINT command that print the content of the window we point at. It has to know on which server that window is.

ex:

I am physically on Server-A, I open up a xterm on it, in it I telenet to Server-B. If I need to print anything from that window, then I need to set DISPLAY=Server-A on Server-B.

I am physically on Server-C, I am working on an xterm logged on to that server, I do an rlogin to Server-D. If I need to print anything from that window, then I need to set DISPLAY=Server-C on Server-D.
# 2  
Old 10-23-2009
Test if a
Code:
who am i

shows from which host you are logged in. On AIX I get this:
Code:
root@host2> who am i
root        pts/1       Oct 23 13:51     (host1)
root@host2:/root> who am i| sed 's/[^(]*(\([^)]*\))/\1/'
host1

You could use that in your command to export DISPLAY.
# 3  
Old 10-23-2009
Works only on the first rlogin.

I am on Server-A
Open up an xterm
log on to Server-B
who am I shows Server-A
on that same window I do rlogin Server-C
who am I shows Server-B


We have 22 servers in total but physically work on 2 of them. We frequently go from servers to servers through windows
# 4  
Old 10-26-2009
"who am i" did it right, as supposed. From your 1st post it was explained there is only 1 server "hop" involved. Hopping further to the next host ie. start on A --- ssh ---> B --- ssh ---> C can't be displayed/checked.
What about typing exit when done on host B and then (back on A) ssh to host C? So "who am i" would give you the needed output in that case. Or is that not possible for the things you do on the boxes?
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Get Hostname in UNIX like environment in Windows (Cgwin, UWin)

Hi, I'm using UWIN (from at&t - a cygwin like environment) in my personal computer to show Unix like environment to someone new to Unix. Though UWin has Ksh command box, wanted to show Putty to that person. My question is. How to connect to Cygwin (or UWin) installed in personal computer... (2 Replies)
Discussion started by: bobbygsk
2 Replies

2. UNIX for Advanced & Expert Users

Hostname -f hostname: Unknown host

deleted (0 Replies)
Discussion started by: hce
0 Replies

3. Shell Programming and Scripting

File exists, but cannot be opened.How to check- whether it could be opened to read when it exists

Hi #Testing for file existence if ; then echo 'SCHOOL data is available for processing' else echo 'SCHOOL DATA IS NOT AVAILABLE FOR PROCESSING' : i wrote a script, where it begins by checking if file exists or not. If it exists, it truncates the database... (2 Replies)
Discussion started by: rxg
2 Replies

4. Emergency UNIX and Linux Support

HP UX - ILO Console hostname different than Machine Hostname...

Hi All, So we added a new HP-UX 11.31 machine. Copied OS via Ignite-UX (DVD)over from this machine called machine_a. It was supposed to be named machine_c. And it is when you log in...however when I'm in the ILO console before logging in, it says: It should say: What gives? And how do... (4 Replies)
Discussion started by: zixzix01
4 Replies

5. Shell Programming and Scripting

Keep database connection opened!

Hello. I have to make a script with more than 1 SQL query and the problem is that i have to alternate from sql commands to unix commands. what i would like to know if it's posible(and how) to keep the databse connection opened till last sql command is ran and execute unix commands while the... (2 Replies)
Discussion started by: daniel1988
2 Replies

6. Shell Programming and Scripting

Checking if any folder is opened or not?

Alogorithm: ============= Whenever any user open any specific directory: 1) cd /usr/lib The prompt should show an Alert message like 2) echo "You have opened this folder" How should I write shell script this one?.. It should be irrespective of users and... (11 Replies)
Discussion started by: Niroj
11 Replies

7. UNIX for Dummies Questions & Answers

Solaris - unknown hostname - how can I change hostname?

Hello, I am new to Solaris. I am using stand alone Solaris 10.0 for test/study purpose and connecting to internet via an ADSL modem which has DHCP server. My Solaris is working on VMWare within winXP. My WinXP and Solaris connects to internet by the same ADSL modem via its DHCP at the same... (1 Reply)
Discussion started by: XNOR
1 Replies

8. HP-UX

How to get the opened files by a process

Hi, i'd like to get the files which are opened by a process during his execution using the c language. Thanks for helping me. (2 Replies)
Discussion started by: benoit.gaillard
2 Replies
Login or Register to Ask a Question