<?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: Script Required in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588636#M857342</link>
    <description>I ran this command in one of my app server . &lt;BR /&gt;&lt;BR /&gt;time lsof -c a -c s -a -i&lt;BR /&gt;&lt;BR /&gt;real     4:07.1&lt;BR /&gt;user        0.3&lt;BR /&gt;sys         0.5&lt;BR /&gt;&lt;BR /&gt;Is it ok . &lt;BR /&gt;</description>
    <pubDate>Tue, 02 Oct 2001 21:26:01 GMT</pubDate>
    <dc:creator>Deepak Seth_1</dc:creator>
    <dc:date>2001-10-02T21:26:01Z</dc:date>
    <item>
      <title>Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588626#M857332</link>
      <description>We have lots of application server and one database server - oracle. User make connection using sqlnet . How do i track a user on application server have a corresponding connection to a database server . They might just be a ghost or runaway process . I have developed a script which use the lsof and find the inet and then match the inet with the inet on the database  sever. &lt;BR /&gt;&lt;BR /&gt;Example : &lt;BR /&gt;&lt;BR /&gt;Application server &lt;BR /&gt;&lt;BR /&gt;lsof | grep inet &lt;BR /&gt;&lt;BR /&gt;api6.1     3369  agriffi    8u  inet  0x23e14400     0t2004     TCP neptune-2.hdc.bio-rad.com:1969-&amp;gt;jupiter-2.hdc.bio-rad.com:1521 (&lt;BR /&gt;Database Server&lt;BR /&gt;&lt;BR /&gt;lsof | grep 1969 &lt;BR /&gt;&lt;BR /&gt;oraclebaa 10805   oracle   11u  inet 0x4d6afc68     0t2004     TCP jupiter-2.hdc.bio-rad.com:listener-&amp;gt;neptune-2.hdc.bio-rad.com:196&lt;BR /&gt;9 (ESTABLISHED)&lt;BR /&gt;&lt;BR /&gt;If it found the corresponding inet that means connection is fine . But this script takes lots of time to run and is not very effective under some circustnaces. Any better method of achieving the results ? &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Oct 2001 19:50:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588626#M857332</guid>
      <dc:creator>Deepak Seth_1</dc:creator>
      <dc:date>2001-10-02T19:50:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588627#M857333</link>
      <description>One thing I can think of is trying to reduce the output from lsof.  I assume you're only looking at TCP connections...&lt;BR /&gt;&lt;BR /&gt;The first lsof could be changed to &lt;BR /&gt;&lt;BR /&gt;lsof -i TCP&lt;BR /&gt;&lt;BR /&gt;This would list all the TCP connections from/to the machine.&lt;BR /&gt;&lt;BR /&gt;Then you can search for the particular connection by:&lt;BR /&gt;&lt;BR /&gt;lsof -i TCP:1969 (from your example).&lt;BR /&gt;&lt;BR /&gt;Also, since the database listener is on a particular port, you could probably narrow the initial search even further, i.e.:&lt;BR /&gt;&lt;BR /&gt;lsof -i TCP:1521&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;-Santosh</description>
      <pubDate>Tue, 02 Oct 2001 19:59:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588627#M857333</guid>
      <dc:creator>Santosh Nair_1</dc:creator>
      <dc:date>2001-10-02T19:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588628#M857334</link>
      <description>Hi Deepak,&lt;BR /&gt;&lt;BR /&gt;Look at the man page for lsof (it has lots of options)&lt;BR /&gt;&lt;BR /&gt;To simplify your search&lt;BR /&gt;&lt;BR /&gt;lsof -i TCP |grep oracle |grep -v ESTABLISH &lt;BR /&gt;&lt;BR /&gt;Would list all the TCP sessions that are not established.&lt;BR /&gt;&lt;BR /&gt;lsof -i | grep oracle |grep -v ESTABLISH&lt;BR /&gt;would list all the sessions that are not extablished&lt;BR /&gt;&lt;BR /&gt;You could modify your script accordingly, based on what you are interested&lt;BR /&gt;&lt;BR /&gt;-HTH&lt;BR /&gt;Ramesh</description>
      <pubDate>Tue, 02 Oct 2001 20:04:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588628#M857334</guid>
      <dc:creator>linuxfan</dc:creator>
      <dc:date>2001-10-02T20:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588629#M857335</link>
      <description>Hi Deepak:&lt;BR /&gt;&lt;BR /&gt;Let's restrict the lsof output. The other guys have mentioned -i and that's good now let's improve it with -c and -a too.&lt;BR /&gt;&lt;BR /&gt;let's say I want all inet sockets the for command the begin with the letter a OR the letter s. All the -c commands are OR'ed automatically; we then use -a to AND with -i (inet).&lt;BR /&gt;&lt;BR /&gt;e.g.&lt;BR /&gt;&lt;BR /&gt;lsof -c a -c s -a -i &lt;BR /&gt;&lt;BR /&gt;The smaller this list is; the faster the rest of the code executes.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Tue, 02 Oct 2001 20:15:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588629#M857335</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-10-02T20:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588630#M857336</link>
      <description>Here is logic of my script . Anyway i can make it fast. &lt;BR /&gt;    &lt;BR /&gt;set -x &lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;database="baanpcdg baanpeu3 baantap"&lt;BR /&gt;&amp;gt; /tmp/notfound.out&lt;BR /&gt;for i in $database&lt;BR /&gt;do&lt;BR /&gt;# Get the hostname &lt;BR /&gt;sysname=`awk -F" " ' $1~ /'"$i"'/ {print $2} ' ~dseth/host.txt `&lt;BR /&gt;# collect all the process related to INET for a particular database&lt;BR /&gt;lsof | grep inet | grep $sysname | awk -F: '{print $1,":", $3}' | awk -F" " '{print $2,$11}'  &amp;gt; /tmp/orabaan.$i&lt;BR /&gt;# remsh to application server and collect the informaion of lsof&lt;BR /&gt;remsh $sysname -n lsof | grep "inet" | grep jupiter | grep -v root | awk -F" " '{print $3,$9}'  &amp;gt; /tmp/lsof.$sysname&lt;BR /&gt;while read a b&lt;BR /&gt;do &lt;BR /&gt;if [ `grep $b /tmp/lsof.$sysname | wc -l ` -eq 0 ]&lt;BR /&gt;then&lt;BR /&gt;RS="-"&lt;BR /&gt;# whodb is a script which shows the user login in a particular database&lt;BR /&gt;# This is to find the name of user/login id &lt;BR /&gt;NAME=`/usr/local/bin/whodb $i | grep $a | awk '{print $1}'`&lt;BR /&gt;if [ -n "$NAME" ]&lt;BR /&gt;then&lt;BR /&gt;echo "$i $a $sysname $b $NAME" &amp;gt;&amp;gt; /tmp/notfound.out&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;done &amp;lt; /tmp/orabaan.$i&lt;BR /&gt;done&lt;BR /&gt;# Finally moving the file a different location for the web server to display in HTML format .&lt;BR /&gt;rcp /tmp/notfound.out devsun2:/tmp/notfound.out&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Oct 2001 20:31:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588630#M857336</guid>
      <dc:creator>Deepak Seth_1</dc:creator>
      <dc:date>2001-10-02T20:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588631#M857337</link>
      <description>Pls. suggest me some modification in my script. &lt;BR /&gt;</description>
      <pubDate>Tue, 02 Oct 2001 20:40:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588631#M857337</guid>
      <dc:creator>Deepak Seth_1</dc:creator>
      <dc:date>2001-10-02T20:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588632#M857338</link>
      <description>Deepak,&lt;BR /&gt;&lt;BR /&gt;You could try using Glance in "adviser only" mode.&lt;BR /&gt;In your own "adviser syntax" you can specify any metric available in Glance, including "open files" such as sockets.&lt;BR /&gt;&lt;BR /&gt;I've attached a sample adviser syntax that lists all sockets (you can modify it further if it seems useful).&lt;BR /&gt;If you save it to, say, sockets.syntax in your current directory, then you can run it as follows:&lt;BR /&gt;&lt;BR /&gt;glance -adviser_only -syntax sockets.syntax&lt;BR /&gt;&lt;BR /&gt;This will give you a "quick start" so you can get some idea if Glance can be useful or not.&lt;BR /&gt;&lt;BR /&gt;The list of available metrics in Glance is under /opt/perf/paperdocs/gp/C/.  More adviser syntax examples are available under /opt/perf/examples/adviser.&lt;BR /&gt;&lt;BR /&gt;Regards ...   Mladen</description>
      <pubDate>Tue, 02 Oct 2001 20:42:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588632#M857338</guid>
      <dc:creator>Mladen Despic</dc:creator>
      <dc:date>2001-10-02T20:42:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588633#M857339</link>
      <description>Hi Deepak:&lt;BR /&gt;&lt;BR /&gt;Without rewriting, I see some major things to improve your script.&lt;BR /&gt;&lt;BR /&gt;First that long string of commands 'lsof | grep inet | grep $sysname | awk -F: '{print $1,":", $3}' | awk -F" " '{print $2,$11}' &amp;gt; /tmp/orabaan.$i'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;That could be replaced by&lt;BR /&gt;lsof (with args above) | awk -f myfile.awk &amp;gt; /tmp/orabann.$i&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Let awk do all that stuff you are doing with grep + awk in a single awk script.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Next, if [ `grep $b /tmp/lsof.$sysname | wc -l ` -eq 0 ] can be replaced with&lt;BR /&gt;grep -q $b /tmp/lsof.$sysname&lt;BR /&gt;STAT=$?&lt;BR /&gt;if [ ${STAT} -eq 0 ]&lt;BR /&gt;  then&lt;BR /&gt;    do your stuff&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;In general, the fewer processes you have to fork, the faster your code will execute but thge very first thing to do is limit the input by adding args to lsof.&lt;BR /&gt;&lt;BR /&gt;Clay</description>
      <pubDate>Tue, 02 Oct 2001 21:04:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588633#M857339</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-10-02T21:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588634#M857340</link>
      <description>I think one of the reason of script taking lot of time is the behaviour of "lsof" command. It just hang from time to time and takes lot of time to complete.&lt;BR /&gt;&lt;BR /&gt;i just tried this command .  &lt;BR /&gt;lsof -c a -c -a -i</description>
      <pubDate>Tue, 02 Oct 2001 21:07:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588634#M857340</guid>
      <dc:creator>Deepak Seth_1</dc:creator>
      <dc:date>2001-10-02T21:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588635#M857341</link>
      <description>Hi Again:&lt;BR /&gt;&lt;BR /&gt;Absolutely, lsof can take a very long time on a busy system especially with no args. I would add the -b arg to avoid functions which can cause blocking. This should not exclude any of the sockets yoiu are looking for.&lt;BR /&gt;&lt;BR /&gt;lsof -c a -c s -a -i -b 2&amp;gt;/dev/null | grep or awk &lt;BR /&gt;&lt;BR /&gt;We redirect stderr so that lsof does not warn you about the possible blocking functions it is avoiding. I think it will not run much faster.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Oct 2001 21:16:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588635#M857341</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2001-10-02T21:16:14Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588636#M857342</link>
      <description>I ran this command in one of my app server . &lt;BR /&gt;&lt;BR /&gt;time lsof -c a -c s -a -i&lt;BR /&gt;&lt;BR /&gt;real     4:07.1&lt;BR /&gt;user        0.3&lt;BR /&gt;sys         0.5&lt;BR /&gt;&lt;BR /&gt;Is it ok . &lt;BR /&gt;</description>
      <pubDate>Tue, 02 Oct 2001 21:26:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588636#M857342</guid>
      <dc:creator>Deepak Seth_1</dc:creator>
      <dc:date>2001-10-02T21:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588637#M857343</link>
      <description>thanx all of you for your quick responses - specially "stephenson" repies helped me immediatelty to tune it some what . It may not impact much since iam not going to run this script very often - may be once every 2 hour . &lt;BR /&gt;&lt;BR /&gt;I will assign the points shortly as it is giving some error right now when u try to assign points. &lt;BR /&gt;&lt;BR /&gt;thanx once again.&lt;BR /&gt;</description>
      <pubDate>Tue, 02 Oct 2001 21:49:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588637#M857343</guid>
      <dc:creator>Deepak Seth_1</dc:creator>
      <dc:date>2001-10-02T21:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588638#M857344</link>
      <description>Trace user script:&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;#/***********************************************************&lt;BR /&gt;#* $Header:&lt;BR /&gt;#* Name: tkprof_rpt&lt;BR /&gt;#* Description: Prompt for tkprof parameters and run tkprof.&lt;BR /&gt;#*&lt;BR /&gt;#* Inputs: Trace filename. (Std. udump directory is assumed)&lt;BR /&gt;#*  Output filename.&lt;BR /&gt;#*  Oracle userid.&lt;BR /&gt;#*  Oracle password.&lt;BR /&gt;#*&lt;BR /&gt;#* Outputs: tkprof output in current dir., or home dir.&lt;BR /&gt;#*&lt;BR /&gt;#* Known limitations:&lt;BR /&gt;#*&lt;BR /&gt;#* Revisions:&lt;BR /&gt;#* Date  who  Description&lt;BR /&gt;#************************************************************/&lt;BR /&gt;&lt;BR /&gt;echo "\n\n"&lt;BR /&gt;&lt;BR /&gt;udump="/home/app/oracle/admin/prd1/udump"&lt;BR /&gt;&lt;BR /&gt;ls -lt $udump | head&lt;BR /&gt;&lt;BR /&gt;echo "\n\nEnter the name of the trace file ................ \c"&lt;BR /&gt;read ans&lt;BR /&gt;if [ ! -r $udump/$ans ]&lt;BR /&gt;then&lt;BR /&gt; echo "You must enter a full file name which you have read permissions"&lt;BR /&gt; echo "from the directroy: $udump"&lt;BR /&gt; exit 1&lt;BR /&gt;fi&lt;BR /&gt;trcfile=$ans&lt;BR /&gt;&lt;BR /&gt;echo "Enter the name of the output (formatted) file ... \c"&lt;BR /&gt;read out&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 03 Oct 2001 14:46:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588638#M857344</guid>
      <dc:creator>Robert Binkley</dc:creator>
      <dc:date>2001-10-03T14:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588639#M857345</link>
      <description>hi robert , &lt;BR /&gt;What is this script doing ? Can u explain me. &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 03 Oct 2001 14:57:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588639#M857345</guid>
      <dc:creator>Deepak Seth_1</dc:creator>
      <dc:date>2001-10-03T14:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588640#M857346</link>
      <description>Hello Deepak,&lt;BR /&gt;&lt;BR /&gt;why do you not use the information from "V$SESSION",&lt;BR /&gt;as I see you are using Oracle as he DB?&lt;BR /&gt;IIRC then all the information you need is available in &lt;BR /&gt;there...&lt;BR /&gt;&lt;BR /&gt;Just my ?0.02,&lt;BR /&gt;Wodisch</description>
      <pubDate>Thu, 04 Oct 2001 18:20:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588640#M857346</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2001-10-04T18:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: Script Required</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588641#M857347</link>
      <description>thanx wodish ,&lt;BR /&gt;I was thinking on the same line since yesterday as this will make my script run much faster and i don't have to live on the functioning of "LSOF" command - which  still behave  differently from time to time. &lt;BR /&gt;&lt;BR /&gt;thanx once again.</description>
      <pubDate>Thu, 04 Oct 2001 19:09:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-required/m-p/2588641#M857347</guid>
      <dc:creator>Deepak Seth_1</dc:creator>
      <dc:date>2001-10-04T19:09:32Z</dc:date>
    </item>
  </channel>
</rss>

