<?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: How to get the process id of a process? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977174#M720439</link>
    <description>brise:root /# jobs&lt;BR /&gt;[2] +  Running                    sleep 6000 &amp;amp;   &lt;BR /&gt;brise:root /# jobs -p %2&lt;BR /&gt;21854&lt;BR /&gt;&lt;BR /&gt;brise:root /# ps -ef | grep 21854&lt;BR /&gt;    root 22308 21624  1 07:07:38 pts/tb    0:00 grep 21854&lt;BR /&gt;    root 21854 21624  0 07:06:09 pts/tb    0:00 sleep 6000  &lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill</description>
    <pubDate>Tue, 20 May 2003 10:03:03 GMT</pubDate>
    <dc:creator>Bill McNAMARA_1</dc:creator>
    <dc:date>2003-05-20T10:03:03Z</dc:date>
    <item>
      <title>How to get the process id of a process?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977170#M720435</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am trying to get the process id of a process I try to start in the background.&lt;BR /&gt;&lt;BR /&gt;I had come to know about a technique of using $! to get the status of last spawned process.&lt;BR /&gt;The above method works for commands like sleep.&lt;BR /&gt;&lt;BR /&gt;When I do $! for my program I get a value, but when I do ps -ef the process id for the process in the listing is greater than the value returned by $! by 1.&lt;BR /&gt;For additional information I am setting setsid() in my program. Does it has anything to do with it.&lt;BR /&gt;&lt;BR /&gt;Can anyone help me out.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;Shashibhushan GOkhale</description>
      <pubDate>Tue, 20 May 2003 09:21:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977170#M720435</guid>
      <dc:creator>Shashibhushan Gokhale</dc:creator>
      <dc:date>2003-05-20T09:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the process id of a process?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977171#M720436</link>
      <description>Try using "$$" to obtain the current Process ID.&lt;BR /&gt;&lt;BR /&gt;Null points if I am not the first to suggest this pse.&lt;BR /&gt;&lt;BR /&gt;Share and Enjoy! Ian</description>
      <pubDate>Tue, 20 May 2003 09:31:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977171#M720436</guid>
      <dc:creator>Ian Dennison_1</dc:creator>
      <dc:date>2003-05-20T09:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the process id of a process?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977172#M720437</link>
      <description>Maybe your program does additional fork()s, e.g. to daemonize itself? In this case it would not be the "direct" child of your shell, i.e. no child the shell can know anything about.&lt;BR /&gt;&lt;BR /&gt;Either you seek the process using ps or you add some code to the program that writes its own PID to some status file, just like syslogd uses /var/run/syslog.pid.&lt;BR /&gt;&lt;BR /&gt;Best regards...&lt;BR /&gt; Dietmar.</description>
      <pubDate>Tue, 20 May 2003 09:33:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977172#M720437</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2003-05-20T09:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the process id of a process?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977173#M720438</link>
      <description>HI Dietmar,&lt;BR /&gt;&lt;BR /&gt;You are absolutely right.&lt;BR /&gt;I am using fork() to daemonize itself.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shashibhushan</description>
      <pubDate>Tue, 20 May 2003 09:59:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977173#M720438</guid>
      <dc:creator>Shashibhushan Gokhale</dc:creator>
      <dc:date>2003-05-20T09:59:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the process id of a process?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977174#M720439</link>
      <description>brise:root /# jobs&lt;BR /&gt;[2] +  Running                    sleep 6000 &amp;amp;   &lt;BR /&gt;brise:root /# jobs -p %2&lt;BR /&gt;21854&lt;BR /&gt;&lt;BR /&gt;brise:root /# ps -ef | grep 21854&lt;BR /&gt;    root 22308 21624  1 07:07:38 pts/tb    0:00 grep 21854&lt;BR /&gt;    root 21854 21624  0 07:06:09 pts/tb    0:00 sleep 6000  &lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill</description>
      <pubDate>Tue, 20 May 2003 10:03:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977174#M720439</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2003-05-20T10:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the process id of a process?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977175#M720440</link>
      <description>Bill,&lt;BR /&gt;after running setsid() the program is the leader of a new process group. So I doubt, that jobs -p is able to find anything (didn't test this myself).&lt;BR /&gt;&lt;BR /&gt;Best regards...&lt;BR /&gt; Dietmar.</description>
      <pubDate>Tue, 20 May 2003 10:11:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977175#M720440</guid>
      <dc:creator>Dietmar Konermann</dc:creator>
      <dc:date>2003-05-20T10:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the process id of a process?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977176#M720441</link>
      <description>to get the process number (pid) of a process you last ran try:&lt;BR /&gt;&lt;BR /&gt;echo $!&lt;BR /&gt;or&lt;BR /&gt;echo $?&lt;BR /&gt;</description>
      <pubDate>Tue, 20 May 2003 10:12:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977176#M720441</guid>
      <dc:creator>John Meissner</dc:creator>
      <dc:date>2003-05-20T10:12:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the process id of a process?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977177#M720442</link>
      <description>okay Dietmar,&lt;BR /&gt;I just read the first line!</description>
      <pubDate>Tue, 20 May 2003 10:22:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-get-the-process-id-of-a-process/m-p/2977177#M720442</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2003-05-20T10:22:41Z</dc:date>
    </item>
  </channel>
</rss>

