- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to configure $REMOTEHOST env variable ?
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
05-16-2008 03:26 AM
05-16-2008 03:26 AM
By default my HP UX m/c doesn't configure $REMOTEHOST variable. How can I configure REMOTEHOST variable ? Pls help me.
Thanks,
Ramesh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 03:35 AM
05-16-2008 03:35 AM
Re: How to configure $REMOTEHOST env variable ?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 03:42 AM
05-16-2008 03:42 AM
Re: How to configure $REMOTEHOST env variable ?
Pete is right! Unless, you know what this variable meaning is, you cannot define it.
If you want to explicitly define this variable, you must execute the following commands:
REMOTEHOST=
export REMOTEHOST
You may also wish to include this in your .profile or /etc/profile
hope this helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 03:56 AM
05-16-2008 03:56 AM
Re: How to configure $REMOTEHOST env variable ?
Sorry for insufficient information.
By default, the $REMOTEHOST env variable is set in the linux env. The $REMOTEHOST variable has the name of the remote host which connected to a linux m/c.
I am trying to get name of the remote m/c which connected to a hpux m/c.This will help to monitor the remote host activities. Hope this clear.
Thanks,
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 03:56 AM
05-16-2008 03:56 AM
Re: How to configure $REMOTEHOST env variable ?
Sorry for the insufficient information.
By default, the $REMOTEHOST env variable is set in the linux env. The $REMOTEHOST variable has the name of the remote host which connected to a linux m/c.
I am trying to get name of the remote m/c which connected to a hpux m/c.This will help to monitor the remote host activities. Hope this clear.
Thanks,
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 04:07 AM
05-16-2008 04:07 AM
Re: How to configure $REMOTEHOST env variable ?
Something like:
who -a | awk -v user=$LOGNAME '$0 ~ user {print $NF}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 04:13 AM
05-16-2008 04:13 AM
Re: How to configure $REMOTEHOST env variable ?
> Dennis: who -a | awk -v user=$LOGNAME '$0 ~ user {print $NF}'
I think Dennis meant 'who -u' as:
# who -u | awk -v user=$LOGNAME '$0 ~ user {print $NF}'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 04:29 AM
05-16-2008 04:29 AM
Re: How to configure $REMOTEHOST env variable ?
Thanks for the response. The following command gives all the m/c names which are currently connected.
who -u | awk -v user=$LOGNAME '$0 ~ user {print $NF}'
But I require the remote m/c name of the current terminal/telnet. I do not require all the remote host names. I am currently working on monitoring of user activities. Please refer the following thread for complete details about the functionality. And also please search REMOTEHOST string in the attachment of that thread. I need to set the exact m/c name into that variable.
http://forums12.itrc.hp.com/service/forums/questionanswer.do?threadId=1232079
Thanks,
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 10:11 PM
05-16-2008 10:11 PM
SolutionYes, for that user.
>But I require the remote m/c name of the current terminal/telnet.
Ok, you can use this script:
#!/usr/bin/ksh
# Find source machine from tty(1)
TTY=$(tty) # issue with pipes
who -u | awk -v tty=$TTY '
BEGIN { tty = substr(tty, 6) } # strip /dev/
$0 ~ tty {print $NF}'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 10:25 PM
05-16-2008 10:25 PM
Re: How to configure $REMOTEHOST env variable ?
The script does not give any output. I have saved the script commands in a file named a.sh and I executed it by "$sh a.sh". It does not print anything in the console. Am I miss anything ?
Thanks,
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 11:15 PM
05-16-2008 11:15 PM
Re: How to configure $REMOTEHOST env variable ?
For your quick reference, my console output of "who -u" command is,
bash-3.00$ who -u
test pts/ta May 1 18:15 . 15226 MEPS1.india.adventnet.com
test pts/tb May 16 15:16 21:10 22735 rameshj.india.adventnet.com
test pts/tc May 17 11:36 0:04 12941 rameshj.india.adventnet.com
test pts/td May 15 15:06 0:09 23817 opman-sigma1.india.adventnet.com
guest pts/0 May 17 10:41 old 11028 assetmgmt-test1.india.adventnet.com
test pts/te May 17 12:23 . 14597 rameshj.india.adventnet.com
test pts/tf May 16 16:35 19:53 26126 rameshj.india.adventnet.com
guest pts/1 Apr 29 01:41 old 20391 console-server.india.adventnet.com
guest pts/2 Apr 29 01:41 old 20402 console-server.india.adventnet.com
My HPUX version is, B.11.11
This may help you to identify the issue.
Thanks,
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 11:15 PM
05-16-2008 11:15 PM
Re: How to configure $REMOTEHOST env variable ?
It worked fine for me, after a lot of tweaking. :-)
>I executed it by "$sh a.sh". It does not print anything in the console. Am I miss anything?
That should be it. But you could make it executable so you don't need to use "sh".
Add this echo here:
TTY=$(tty) # issue with pipes
echo "TTY is: $TTY"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2008 11:22 PM
05-16-2008 11:22 PM
Re: How to configure $REMOTEHOST env variable ?
After adding the echo the script output is,
bash-3.00$ ./a.sh
TTY is: /dev/ttyp6
bash-3.00$
I could not find any information related to tty in the who -u command output. This may be configuration issue. But I am sure.
Thanks,
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2008 12:18 AM
05-17-2008 12:18 AM
Re: How to configure $REMOTEHOST env variable ?
Thanks. I don't see your tty there.
>I could not find any information related to tty in the who -u command output.
It talks about "line". There is also mention about using -R with -u but I don't see much difference.
What do you get for: pty
And: ll -i /dev/ttyp6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2008 01:38 AM
05-17-2008 01:38 AM
Re: How to configure $REMOTEHOST env variable ?
Following are the output of the required commands,
bash-3.00$ pty
/dev/ttyp6
bash-3.00$ ll -i /dev/ttyp6
822 crw--w---- 2 test tty 17 0x000006 May 17 14:55 /dev/ttyp6
bash-3.00$
Thanks,
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2008 01:54 AM
05-17-2008 01:54 AM
Re: How to configure $REMOTEHOST env variable ?
>$ ll -i /dev/ttyp6
822 crw--w---- 2 test tty 17 0x000006 May 17 14:55 /dev/ttyp6
Perhaps there are two names for this tty? How about:
$ find /dev -inum 822
(On my system the basenames of the files match.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2008 01:58 AM
05-17-2008 01:58 AM
Re: How to configure $REMOTEHOST env variable ?
# find /dev -inum 822
/dev/pty/ttyp6
/dev/ttyp6
#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2008 02:32 AM
05-17-2008 02:32 AM
Re: How to configure $REMOTEHOST env variable ?
>/dev/pty/ttyp6 /dev/ttyp6
Hmm, I'm not sure how to map these BSD pseudo terminals to your Streams pseudo-terminals.
Looking at pts(7) ptm(7) pty(7) doesn't mention it.
You might be able to map the time stamp on ttyp6 with one in the /dev/pts/ directory???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2008 02:58 AM
05-17-2008 02:58 AM
Re: How to configure $REMOTEHOST env variable ?
If the script suggested by you is working fine for most of the HP UX system, I may go with that script. In case of any issue in finding remote host(like my local HP UX m/c), my application log will be reported as "Unknown Host". But I would like convert your script into 2 lines and assign the host name into a variable named REMOTEHOST. Is the following 2 lines working fine in ur m/c ? ie, the REMOTEHOST variable is properly assigned with actual value. This will help me integrate the same.
TTY=$(tty) # issue with pipes
REMOTEHOST=`who -u | awk -v tty=$TTY 'BEGIN { tty = substr(tty, 6) } $0 ~ tty {print $NF}'`
Since the issue in my m/c may be due to configuration issue, we will try to identify the issue in parallel.
I really appreciate your great support and effort on resolving the issue. Thank you very much.
Thanks,
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2008 03:24 AM
05-17-2008 03:24 AM
Re: How to configure $REMOTEHOST env variable ?
Yes. But you shouldn't use the obsolete ``.
Use this one liner:
REMOTEHOST=$(TTY=$(tty); who -u | awk -v tty=$TTY 'BEGIN { tty = substr(tty, 6) } $0 ~ tty {print $NF}')
Note you don't really need to put this all on one line. You can do:
REMOTEHOST=$(TTY=$(tty)
who -u |
awk -v tty=$TTY '
BEGIN { tty = substr(tty, 6) }
$0 ~ tty {print $NF}')