<?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 existence. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468913#M774863</link>
    <description>Do not worry Dan !&lt;BR /&gt;&lt;BR /&gt;I did not feel offended at all !&lt;BR /&gt;I really thought what I said, and I agreed that your example, even quick and dirty, was really what Sandip was looking for !&lt;BR /&gt;&lt;BR /&gt;Again, sorry for misunderstanding !!&lt;BR /&gt;&lt;BR /&gt;Best regards.</description>
    <pubDate>Thu, 30 Nov 2000 13:06:50 GMT</pubDate>
    <dc:creator>Frederic Soriano</dc:creator>
    <dc:date>2000-11-30T13:06:50Z</dc:date>
    <item>
      <title>Process existence.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468906#M774856</link>
      <description>&lt;BR /&gt;Hi Admin,&lt;BR /&gt;&lt;BR /&gt;Is there an API support to know if a process is already running ?&lt;BR /&gt;I had tried &lt;BR /&gt; system("export aVar=ps -e | grep -v grep | grep -n Procname);&lt;BR /&gt;&lt;BR /&gt;but it did not work. &lt;BR /&gt;Would someone advise me how I can get this status.&lt;BR /&gt;&lt;BR /&gt;Sandip</description>
      <pubDate>Thu, 30 Nov 2000 06:54:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468906#M774856</guid>
      <dc:creator>Sandip Samanta_1</dc:creator>
      <dc:date>2000-11-30T06:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Process existence.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468907#M774857</link>
      <description>Hi Sandip,&lt;BR /&gt;&lt;BR /&gt;This works for a single process:&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;&lt;BR /&gt;main()&lt;BR /&gt;{&lt;BR /&gt;FILE *command;&lt;BR /&gt;long process_id;&lt;BR /&gt;char pnum[12];&lt;BR /&gt;command=popen("ps -ef|grep lpsched | grep -v grep|awk '{print $2}'","r");&lt;BR /&gt;fgets(pnum,12,command);&lt;BR /&gt;process_id=atol(pnum);&lt;BR /&gt;printf("process number = %ld\n",process_id);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;&lt;BR /&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Thu, 30 Nov 2000 09:13:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468907#M774857</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2000-11-30T09:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Process existence.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468908#M774858</link>
      <description>Hi again,&lt;BR /&gt;&lt;BR /&gt;I didn't mention that it was a "quick and dirty" solution but you realised that by yourself, didn't you?&lt;BR /&gt;&lt;BR /&gt;;-)&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Nov 2000 09:14:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468908#M774858</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2000-11-30T09:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Process existence.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468909#M774859</link>
      <description>Have a look at the pstat() system call, which can be found in /usr/include/sys/pstat.h.&lt;BR /&gt;&lt;BR /&gt;In the pstat(2) manpage, there are lots of useful examples, such as this one:&lt;BR /&gt;&lt;BR /&gt;       /*&lt;BR /&gt;        * Example 4: Get a particular process' information&lt;BR /&gt;        */&lt;BR /&gt;       {&lt;BR /&gt;            struct pst_status pst;&lt;BR /&gt;            int target = (int)getppid();&lt;BR /&gt;&lt;BR /&gt;            if (pstat_getproc(&amp;amp;pst, sizeof(pst), (size_t)0, target) != -1)&lt;BR /&gt;                 (void)printf("Parent started at %s", ctime(&amp;amp;pst.pst_start));&lt;BR /&gt;            else&lt;BR /&gt;                 perror("pstat_getproc");&lt;BR /&gt;       }&lt;BR /&gt;&lt;BR /&gt;Hope that helps !&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Thu, 30 Nov 2000 09:17:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468909#M774859</guid>
      <dc:creator>Frederic Soriano</dc:creator>
      <dc:date>2000-11-30T09:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Process existence.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468910#M774860</link>
      <description>Hi Frederic,&lt;BR /&gt;&lt;BR /&gt;Your solution will only be useful for the current process (PID), or the parent (PPID)&lt;BR /&gt;&lt;BR /&gt;I understood that Sandip is checking for a totally unrelated process.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Nov 2000 09:26:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468910#M774860</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2000-11-30T09:26:27Z</dc:date>
    </item>
    <item>
      <title>Re: Process existence.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468911#M774861</link>
      <description>Yes Dan, you're right.&lt;BR /&gt;Your example is better than mine :o)&lt;BR /&gt;&lt;BR /&gt;I simply wanted Sandip to look at pstat(2) manpage for further help.&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Thu, 30 Nov 2000 12:47:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468911#M774861</guid>
      <dc:creator>Frederic Soriano</dc:creator>
      <dc:date>2000-11-30T12:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Process existence.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468912#M774862</link>
      <description>Hi Frederic&lt;BR /&gt;&lt;BR /&gt;Don't take offence, please! I was just trying to clarify the initial question.  &lt;BR /&gt;&lt;BR /&gt;My example wasn't any better than yours, I even mentioned above that it was a "quick and dirty" solution, didn't I ? &lt;BR /&gt;;-)&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Nov 2000 12:52:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468912#M774862</guid>
      <dc:creator>Dan Hetzel</dc:creator>
      <dc:date>2000-11-30T12:52:20Z</dc:date>
    </item>
    <item>
      <title>Re: Process existence.</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468913#M774863</link>
      <description>Do not worry Dan !&lt;BR /&gt;&lt;BR /&gt;I did not feel offended at all !&lt;BR /&gt;I really thought what I said, and I agreed that your example, even quick and dirty, was really what Sandip was looking for !&lt;BR /&gt;&lt;BR /&gt;Again, sorry for misunderstanding !!&lt;BR /&gt;&lt;BR /&gt;Best regards.</description>
      <pubDate>Thu, 30 Nov 2000 13:06:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/process-existence/m-p/2468913#M774863</guid>
      <dc:creator>Frederic Soriano</dc:creator>
      <dc:date>2000-11-30T13:06:50Z</dc:date>
    </item>
  </channel>
</rss>

