<?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: Regarding ps command in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001650#M772976</link>
    <description>I ran the test1.sh in another window and i tried the below things  but i am still getting some errors&lt;BR /&gt;==&amp;gt; UNIX95=ps -C"test1.sh"&lt;BR /&gt;ksh: -Ctest1.sh:  not found&lt;BR /&gt;==&amp;gt; UNIX95=ps -C test1.sh&lt;BR /&gt;ksh: -C:  not found&lt;BR /&gt;==&amp;gt; UNIX95=ps -C "test1.sh"&lt;BR /&gt;ksh: -C:  not found</description>
    <pubDate>Sat, 09 Sep 2006 02:52:58 GMT</pubDate>
    <dc:creator>vind123</dc:creator>
    <dc:date>2006-09-09T02:52:58Z</dc:date>
    <item>
      <title>Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001644#M772970</link>
      <description>I want to check whether a process is running in my unix shell script. If the process is not running i want to quit from the shell script&lt;BR /&gt;I do the below from unix shell prompt &lt;BR /&gt;ps -eaf | grep -i rpt&lt;BR /&gt;&lt;BR /&gt;I want to put this one in a shell script and do the above check. how can i do it?</description>
      <pubDate>Thu, 07 Sep 2006 02:47:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001644#M772970</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-07T02:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001645#M772971</link>
      <description>Simple.&lt;BR /&gt;&lt;BR /&gt;ps -ef|grep [p]rocess_name || exit 1&lt;BR /&gt;&lt;BR /&gt;But, it's not good enough.&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -C"Process_name" || { echo "Process not running" ; exit 1 ; }</description>
      <pubDate>Thu, 07 Sep 2006 02:55:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001645#M772971</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-09-07T02:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001646#M772972</link>
      <description>ps -C "test1.sh"&lt;BR /&gt;ps: illegal option -- C&lt;BR /&gt;usage: ps [-edaflP] [-u ulist] [-g glist] [-p plist] [-t tlist] [-R prmgroup]&lt;BR /&gt;&lt;BR /&gt;Also i want to see whether the daemon runs under any user id. &lt;BR /&gt;I am getting the below output if i ran when the daemon process is not running&lt;BR /&gt;ps -eaf | grep -i test1.sh&lt;BR /&gt;hal  1531  1506  1 06:04:35 ttyp4     0:00 grep -i test1.sh</description>
      <pubDate>Thu, 07 Sep 2006 06:09:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001646#M772972</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-07T06:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001647#M772973</link>
      <description>Look at my post. for doing ps -C, you need to do export UNIX95=1, else just do&lt;BR /&gt;UNIX95= ps -C"process_name"</description>
      <pubDate>Thu, 07 Sep 2006 06:18:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001647#M772973</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2006-09-07T06:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001648#M772974</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;RAC's method using the UNIX95 behavior of 'ps' to look for a process by name is guaranteed to match the process's name.  Using 'grep' without regular expression anchors in the expression can lead to finding processes you *don't* intend to find!&lt;BR /&gt;&lt;BR /&gt;*However*, don't export UNIX95 into your environment.  You may find that the behavior of commands other than 'ps' change in unexpected ways!&lt;BR /&gt;&lt;BR /&gt;By doing:&lt;BR /&gt;&lt;BR /&gt;# UNIX95= ps -C mything -o pid=&lt;BR /&gt;&lt;BR /&gt;...for example, you arm UNIX95 behavior *only* for the duration of the command line -- a safe mode.  Note that a space follows the equal sign and no semicolon appears before the 'ps'.&lt;BR /&gt;&lt;BR /&gt;In the example, above, if there was a process named "mything", one line of output would be returned containing the process pid.  The equal sign after the keyword "pid" suppresses the normal column header that would appear over it in its absence.&lt;BR /&gt;&lt;BR /&gt;The manpages for 'ps' document and provide more information for these behaviors.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 07 Sep 2006 06:31:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001648#M772974</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-07T06:31:32Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001649#M772975</link>
      <description>&lt;!--!*#--&gt;vind123,&lt;BR /&gt;&lt;BR /&gt;If you really want to go the 'ps ... | grep ...' route, you must exclude the grep process itself from the results:&lt;BR /&gt;&lt;BR /&gt;# ps -ef | grep -i test1.sh | grep -v grep&lt;BR /&gt;&lt;BR /&gt;As RAC suggested, "ps -C&lt;PROC_NAME&gt;" is the safer option, as &lt;PROC_NAME&gt; must be an exact match.&lt;BR /&gt;&lt;BR /&gt;# UNIX95=1 ps -o comm= -C test1.sh&lt;BR /&gt;will elimate the header line.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;UNIX95=1 ps -o comm= -C test1.sh&lt;BR /&gt;if [[ ${?} -ne 0 ]]&lt;BR /&gt;then&lt;BR /&gt;  echo "test1.sh not running!" &amp;gt;&amp;amp;2&lt;BR /&gt;  exit 1&lt;BR /&gt;fi&lt;BR /&gt;...What to do if test1.sh is running here...&lt;BR /&gt;exit 0&lt;BR /&gt;&lt;BR /&gt;PCS&lt;/PROC_NAME&gt;&lt;/PROC_NAME&gt;</description>
      <pubDate>Thu, 07 Sep 2006 06:43:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001649#M772975</guid>
      <dc:creator>spex</dc:creator>
      <dc:date>2006-09-07T06:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001650#M772976</link>
      <description>I ran the test1.sh in another window and i tried the below things  but i am still getting some errors&lt;BR /&gt;==&amp;gt; UNIX95=ps -C"test1.sh"&lt;BR /&gt;ksh: -Ctest1.sh:  not found&lt;BR /&gt;==&amp;gt; UNIX95=ps -C test1.sh&lt;BR /&gt;ksh: -C:  not found&lt;BR /&gt;==&amp;gt; UNIX95=ps -C "test1.sh"&lt;BR /&gt;ksh: -C:  not found</description>
      <pubDate>Sat, 09 Sep 2006 02:52:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001650#M772976</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-09T02:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001651#M772977</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;You need a space character (or tab) *after* the equal sign and *before* the 'ps' command:&lt;BR /&gt;&lt;BR /&gt;# UNIX95= ps -C test1.sh&lt;BR /&gt;&lt;BR /&gt;...NOT:&lt;BR /&gt;&lt;BR /&gt;# UNIX95=ps -C test1.sh&lt;BR /&gt;&lt;BR /&gt;Since whitespace is difficult to see on the Forum, cut-and-paste the above renditions if you need to see this.&lt;BR /&gt;&lt;BR /&gt;Note that enclosing the program name argument for the '-C' switch is unnecessary.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 09 Sep 2006 07:30:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001651#M772977</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-09T07:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001652#M772978</link>
      <description>&lt;!--!*#--&gt;It will help to understand how the -C option works. The man page for ps explains that -C (and -o -H and other options) is not standard. Instead, these options are only valid when XPG4 behavior is requested. The method is to set the variable UNIX95 to anything, which is the same as defining the variable. You can turn on this feature with UNIX95=1 or UNIX95=YYY or the simplest way is UNIX95=. But because UNIX95 can have unexpected results with other programs, you set it temporarily on the same line. Essentially, there are two commands on the line: UNIX95= followed by ps and options.&lt;BR /&gt; &lt;BR /&gt;It may help to understand this temporary construct by using the command this way:&lt;BR /&gt; &lt;BR /&gt;UNIX95=1  ps -o pid=  -o args=  -C test.sh&lt;BR /&gt; &lt;BR /&gt;I have posted this answer using the Retain formatting option so you can better see the spaces. Again this is all on 1 line.</description>
      <pubDate>Sat, 09 Sep 2006 18:59:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001652#M772978</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2006-09-09T18:59:54Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001653#M772979</link>
      <description>Thanks a lot. It's working&lt;BR /&gt;&lt;BR /&gt;1)  The below command is working. Hope it will work even if the test.sh runs under another unix user id or root user id? &lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -C test1.sh &lt;BR /&gt;&lt;BR /&gt;2.  I tried this one and it gives some error&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -C test1.sh pid=                                &lt;BR /&gt;ps: Unknown option (pid=).</description>
      <pubDate>Thu, 14 Sep 2006 10:35:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001653#M772979</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-14T10:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001654#M772980</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;You need:&lt;BR /&gt;&lt;BR /&gt;# UNIX95= ps -C test1.sh -o pid&lt;BR /&gt;&lt;BR /&gt;...whereas you had:&lt;BR /&gt;&lt;BR /&gt;# UNIX95= ps -C test1.sh pid=&lt;BR /&gt;&lt;BR /&gt;...with the '-o ' to signal that the 'pid=' was the option.&lt;BR /&gt;&lt;BR /&gt;Similarly, if you want to add additional fields (here, without labels), repliate the '-o' switch like:&lt;BR /&gt;&lt;BR /&gt;# UNIX95= ps -C vhand -o pid= -o ppid= -o comm=  &lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 14 Sep 2006 11:32:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001654#M772980</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-09-14T11:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001655#M772981</link>
      <description>Thanks a lot for the info</description>
      <pubDate>Fri, 15 Sep 2006 07:24:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001655#M772981</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-15T07:24:50Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding ps command</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001656#M772982</link>
      <description>Thanks a lot for the info</description>
      <pubDate>Mon, 18 Sep 2006 06:16:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-ps-command/m-p/5001656#M772982</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-09-18T06:16:29Z</dc:date>
    </item>
  </channel>
</rss>

