<?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: ps command in ksh script fails in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ps-command-in-ksh-script-fails/m-p/4728243#M655455</link>
    <description>&amp;gt; usage: ps [ -aAdeflcjLPyZ ] [ -o format ] [ -t termlist ]&lt;BR /&gt; &lt;BR /&gt;This isn't an HP-UX ps option list. Are you running on HP-UX or are you using a non-standard ps.&lt;BR /&gt; &lt;BR /&gt;Note that ps piped to grep will be full of problems because grep won't look in just one part of the line. -u is the user option in HP-UX so there is no need to use "grep something" or "grep -v grep" at all. Simply run the command:&lt;BR /&gt; &lt;BR /&gt;ps -f -u someuser&lt;BR /&gt; &lt;BR /&gt;ps will perform an exact match on the user field. This will show a title line even with no matches, so you can use the -o option to pick the fields you want to use:&lt;BR /&gt; &lt;BR /&gt;UNIX95=1 ps -u someuser -o pid= -o ppid= -o ruser -o args&lt;BR /&gt; &lt;BR /&gt;UNIX95=1 is required for HP-UX ps to use the -o option. NOTE: not much of this applies to non-HP-UX systems.</description>
    <pubDate>Sun, 19 Dec 2010 22:46:34 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2010-12-19T22:46:34Z</dc:date>
    <item>
      <title>ps command in ksh script fails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ps-command-in-ksh-script-fails/m-p/4728241#M655453</link>
      <description>For the life of me, I have no idea why this keeps failing, I have tried multiple different ways to get this to work. I run this as a test, no problem it works, as soon as I run in cron it fails with:&lt;BR /&gt;ps: option requires an argument -- u&lt;BR /&gt;usage: ps [ -aAdeflcjLPyZ ] [ -o format ] [ -t termlist ]&lt;BR /&gt;&lt;BR /&gt;(( count=40 ))&lt;BR /&gt;while ((count -=1))&lt;BR /&gt;do&lt;BR /&gt;  MQSTAT=`ps -ef |grep amqzxma0 |grep -v grep`&lt;BR /&gt;        if [[ -z $MQSTAT ]]&lt;BR /&gt;        then&lt;BR /&gt;        break&lt;BR /&gt;        fi&lt;BR /&gt;  sleep 30&lt;BR /&gt;  echo $MQSTAT &amp;gt;&amp;gt;$SSLOG&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 19 Dec 2010 07:34:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ps-command-in-ksh-script-fails/m-p/4728241#M655453</guid>
      <dc:creator>Ratzie</dc:creator>
      <dc:date>2010-12-19T07:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: ps command in ksh script fails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ps-command-in-ksh-script-fails/m-p/4728242#M655454</link>
      <description>I just see "ps -ef", no -u at all.&lt;BR /&gt;You may want to add "set -x" to your shell script to see what is executing.</description>
      <pubDate>Sun, 19 Dec 2010 08:40:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ps-command-in-ksh-script-fails/m-p/4728242#M655454</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-12-19T08:40:27Z</dc:date>
    </item>
    <item>
      <title>Re: ps command in ksh script fails</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ps-command-in-ksh-script-fails/m-p/4728243#M655455</link>
      <description>&amp;gt; usage: ps [ -aAdeflcjLPyZ ] [ -o format ] [ -t termlist ]&lt;BR /&gt; &lt;BR /&gt;This isn't an HP-UX ps option list. Are you running on HP-UX or are you using a non-standard ps.&lt;BR /&gt; &lt;BR /&gt;Note that ps piped to grep will be full of problems because grep won't look in just one part of the line. -u is the user option in HP-UX so there is no need to use "grep something" or "grep -v grep" at all. Simply run the command:&lt;BR /&gt; &lt;BR /&gt;ps -f -u someuser&lt;BR /&gt; &lt;BR /&gt;ps will perform an exact match on the user field. This will show a title line even with no matches, so you can use the -o option to pick the fields you want to use:&lt;BR /&gt; &lt;BR /&gt;UNIX95=1 ps -u someuser -o pid= -o ppid= -o ruser -o args&lt;BR /&gt; &lt;BR /&gt;UNIX95=1 is required for HP-UX ps to use the -o option. NOTE: not much of this applies to non-HP-UX systems.</description>
      <pubDate>Sun, 19 Dec 2010 22:46:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ps-command-in-ksh-script-fails/m-p/4728243#M655455</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2010-12-19T22:46:34Z</dc:date>
    </item>
  </channel>
</rss>

