<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: MC Package Name in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583457#M924686</link>
    <description>Hi Sandip,&lt;BR /&gt;&lt;BR /&gt;You could do something like this,&lt;BR /&gt;&lt;BR /&gt;Create a file called /etc/checkhost&lt;BR /&gt;&lt;BR /&gt;/Begin/ &lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;trap "" 1 2 3&lt;BR /&gt;&lt;BR /&gt;PATH=/usr/bin:/sbin:/usr/local/bin&lt;BR /&gt;UID=$(/usr/bin/id -u)&lt;BR /&gt;&lt;BR /&gt;who -mu | awk '{print $2, $NF}' | while read TTY host&lt;BR /&gt;do&lt;BR /&gt;MYPID=`ps -ef |egrep " $PPID "|egrep -v "$$|egrep" | awk '{print $2}'`&lt;BR /&gt;&lt;BR /&gt;TO_HOST=`lsof -p $MYPID | egrep ":telnet|:login" |head -1 | awk '{print $9}'|cut -d: -f1`&lt;BR /&gt;&lt;BR /&gt;echo "##################################"&lt;BR /&gt;echo "You logged in to host $TO_HOST"&lt;BR /&gt;# You can do additional commands here based on the static or relocatable host &lt;BR /&gt;echo "########################"&lt;BR /&gt;sleep 4&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;/End/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Also modify your /etc/profile to include&lt;BR /&gt;&lt;BR /&gt;/Begin/&lt;BR /&gt;if [ -f /etc/checkhost ]&lt;BR /&gt;then&lt;BR /&gt;. /etc/checkhost&lt;BR /&gt;fi&lt;BR /&gt;/End/&lt;BR /&gt;-HTH&lt;BR /&gt;Ramesh&lt;BR /&gt;</description>
    <pubDate>Sun, 23 Sep 2001 13:40:11 GMT</pubDate>
    <dc:creator>linuxfan</dc:creator>
    <dc:date>2001-09-23T13:40:11Z</dc:date>
    <item>
      <title>MC Package Name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583455#M924684</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Is it possible to know which user has loged in which package of MC/Service Guard ? Actually we have one cluster. 4 nodes is attached with that cluster. Now generally our user logs in by making telnet &lt;PACKAGE name=""&gt;. So actually physically they logs in different node. But if I want to execute some command which will act according to package name. Then how I can execute. Becs hostname will return node name.&lt;BR /&gt;&lt;BR /&gt;Is their anyway to know package name where user has logged in ?&lt;BR /&gt;&lt;/PACKAGE&gt;</description>
      <pubDate>Sun, 23 Sep 2001 08:27:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583455#M924684</guid>
      <dc:creator>Smirjit Singh</dc:creator>
      <dc:date>2001-09-23T08:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: MC Package Name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583456#M924685</link>
      <description>Sandip,&lt;BR /&gt;&lt;BR /&gt;One way that occured to me was to use the lsof command on the parent telnetd process, something like of -p $PPID|grep TCP.  One of the field in this is the ip/hostname that established the telnet session.&lt;BR /&gt;&lt;BR /&gt;I'm sure there are better ways, but this is what I came up with off the top off my head.&lt;BR /&gt;&lt;BR /&gt;-Santosh</description>
      <pubDate>Sun, 23 Sep 2001 11:49:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583456#M924685</guid>
      <dc:creator>Santosh Nair_1</dc:creator>
      <dc:date>2001-09-23T11:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: MC Package Name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583457#M924686</link>
      <description>Hi Sandip,&lt;BR /&gt;&lt;BR /&gt;You could do something like this,&lt;BR /&gt;&lt;BR /&gt;Create a file called /etc/checkhost&lt;BR /&gt;&lt;BR /&gt;/Begin/ &lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;trap "" 1 2 3&lt;BR /&gt;&lt;BR /&gt;PATH=/usr/bin:/sbin:/usr/local/bin&lt;BR /&gt;UID=$(/usr/bin/id -u)&lt;BR /&gt;&lt;BR /&gt;who -mu | awk '{print $2, $NF}' | while read TTY host&lt;BR /&gt;do&lt;BR /&gt;MYPID=`ps -ef |egrep " $PPID "|egrep -v "$$|egrep" | awk '{print $2}'`&lt;BR /&gt;&lt;BR /&gt;TO_HOST=`lsof -p $MYPID | egrep ":telnet|:login" |head -1 | awk '{print $9}'|cut -d: -f1`&lt;BR /&gt;&lt;BR /&gt;echo "##################################"&lt;BR /&gt;echo "You logged in to host $TO_HOST"&lt;BR /&gt;# You can do additional commands here based on the static or relocatable host &lt;BR /&gt;echo "########################"&lt;BR /&gt;sleep 4&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;/End/&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Also modify your /etc/profile to include&lt;BR /&gt;&lt;BR /&gt;/Begin/&lt;BR /&gt;if [ -f /etc/checkhost ]&lt;BR /&gt;then&lt;BR /&gt;. /etc/checkhost&lt;BR /&gt;fi&lt;BR /&gt;/End/&lt;BR /&gt;-HTH&lt;BR /&gt;Ramesh&lt;BR /&gt;</description>
      <pubDate>Sun, 23 Sep 2001 13:40:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583457#M924686</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-09-23T13:40:11Z</dc:date>
    </item>
    <item>
      <title>Re: MC Package Name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583458#M924687</link>
      <description>Just thought of another way to get this information...&lt;BR /&gt;&lt;BR /&gt;Get the hostname where the user came from using last -R -1 $LOGNAME.  Then use netstat -a |grep &lt;HOSTNAME&gt;&lt;BR /&gt;to get the IP address that they telneted to.  &lt;BR /&gt;&lt;BR /&gt;---snip---&lt;BR /&gt;FRM_HOST=$(last -R -1 snair|awk '{print $3}'|cut -f 1 -d.)&lt;BR /&gt;TO_HOST=$(netstat -a|grep $FRM_HOST|awk '{print $4'}|cut -f 1 -d.)&lt;BR /&gt;&lt;BR /&gt;Code can probably be cleaned up a lot, but basically this is how it would work.&lt;BR /&gt;&lt;BR /&gt;-Santosh&lt;/HOSTNAME&gt;</description>
      <pubDate>Sun, 23 Sep 2001 14:18:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583458#M924687</guid>
      <dc:creator>Santosh Nair_1</dc:creator>
      <dc:date>2001-09-23T14:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: MC Package Name</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583459#M924688</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;If you have logging enabled for telnet in /etc/services , then i think you can find this info from /var/adm/syslog/syslog.log. Just a thought.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Sun, 23 Sep 2001 16:08:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mc-package-name/m-p/2583459#M924688</guid>
      <dc:creator>Sanjay_6</dc:creator>
      <dc:date>2001-09-23T16:08:34Z</dc:date>
    </item>
  </channel>
</rss>

