<?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: Process ID in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864700#M96965</link>
    <description>Other option would be to grep for all the process started by that user with ps -efl|grep username&lt;BR /&gt;&lt;BR /&gt;and grep for "nice process" = 24.&lt;BR /&gt;Coz we know all background process are started by a nice process at 24. So a complete command would look like&lt;BR /&gt;ps -efl|grep username|grep -e 24&lt;BR /&gt;&lt;BR /&gt;Rajeev</description>
    <pubDate>Sun, 15 Dec 2002 23:21:24 GMT</pubDate>
    <dc:creator>Rajeev  Shukla</dc:creator>
    <dc:date>2002-12-15T23:21:24Z</dc:date>
    <item>
      <title>Process ID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864697#M96962</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;How do I find out the process ID of the process running in the background invoked by some script executed by one particular user.&lt;BR /&gt;&lt;BR /&gt;Note :- Some other users may be running the same script which invokes similar background processes. But I would like to know the process ID of the background process invoked by the script executed by me only.&lt;BR /&gt;&lt;BR /&gt;Thanks &lt;BR /&gt;Venky</description>
      <pubDate>Sun, 15 Dec 2002 12:21:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864697#M96962</guid>
      <dc:creator>Venky_1</dc:creator>
      <dc:date>2002-12-15T12:21:26Z</dc:date>
    </item>
    <item>
      <title>Re: Process ID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864698#M96963</link>
      <description>When a process is kicked off in the background, the variable $! is set the the process ID of that process, so just grab the value of $! immediately after starting your background process:&lt;BR /&gt;&lt;BR /&gt;myscript.sh &amp;amp;&lt;BR /&gt;pid_of_myscript=$!&lt;BR /&gt;&lt;BR /&gt;And then I could do these kind of things:&lt;BR /&gt;&lt;BR /&gt;kill $pid_of_myscript&lt;BR /&gt;&lt;BR /&gt;to stop the background process, or&lt;BR /&gt;&lt;BR /&gt;wait $pid_of_myscript&lt;BR /&gt;&lt;BR /&gt;to wait for it to complete.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan&lt;BR /&gt;</description>
      <pubDate>Sun, 15 Dec 2002 19:12:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864698#M96963</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2002-12-15T19:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Process ID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864699#M96964</link>
      <description>Hi Venky,&lt;BR /&gt;&lt;BR /&gt;in case you want to see somebody else's child processes, you could go for the adittional features of the "ps" command:&lt;BR /&gt;&lt;BR /&gt;UNIX95=x ps -eHo ppid,pid,args |&lt;BR /&gt;more&lt;BR /&gt;&lt;BR /&gt;you will see all processes sorted by their parent process's PID now.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Wodisch</description>
      <pubDate>Sun, 15 Dec 2002 23:10:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864699#M96964</guid>
      <dc:creator>Wodisch</dc:creator>
      <dc:date>2002-12-15T23:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: Process ID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864700#M96965</link>
      <description>Other option would be to grep for all the process started by that user with ps -efl|grep username&lt;BR /&gt;&lt;BR /&gt;and grep for "nice process" = 24.&lt;BR /&gt;Coz we know all background process are started by a nice process at 24. So a complete command would look like&lt;BR /&gt;ps -efl|grep username|grep -e 24&lt;BR /&gt;&lt;BR /&gt;Rajeev</description>
      <pubDate>Sun, 15 Dec 2002 23:21:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864700#M96965</guid>
      <dc:creator>Rajeev  Shukla</dc:creator>
      <dc:date>2002-12-15T23:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Process ID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864701#M96966</link>
      <description>Hi Venky,&lt;BR /&gt;&lt;BR /&gt;Edit the script and place the following in the beginning.&lt;BR /&gt;&lt;BR /&gt;echo "$(date): $0: $(whoami): $$" &amp;gt;&amp;gt; /tmp/$0.pids&lt;BR /&gt;&lt;BR /&gt;Look at /tmp/your_script_name.pids file to look at the pid corresponding to each user.&lt;BR /&gt;&lt;BR /&gt;Basically "$$" does the trick within the script.&lt;BR /&gt;&lt;BR /&gt;If you don't want to modify it, use the variable $! to find out the background process&lt;BR /&gt;&lt;BR /&gt;$./your_script&amp;amp;&lt;BR /&gt;$echo $!&lt;BR /&gt;&lt;BR /&gt;$! does the trick outside the script. It will be saved until your logoff or execute another background script.&lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 16 Dec 2002 00:12:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-id/m-p/2864701#M96966</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2002-12-16T00:12:59Z</dc:date>
    </item>
  </channel>
</rss>

