<?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: checking conditions in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593320#M33174</link>
    <description>&lt;BR /&gt;function _not_running {&lt;BR /&gt;        RUNNING=$(ps -ef|grep "$0"|grep -v grep|grep -v $$|grep -v man)&lt;BR /&gt;        if [[ "$RUNNING" != "" ]]&lt;BR /&gt;        then&lt;BR /&gt;         PID=$(echo ${RUNNING} | awk {"print \$2;exit"})&lt;BR /&gt;         echo "\nERROR: The tool is already running under pid: ${PID}\n"&lt;BR /&gt;         echo "You must wait until it completes.\n"&lt;BR /&gt;         exit 1&lt;BR /&gt;        fi&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;you can modify the important bit into your loop with &lt;BR /&gt;for i in $(ps -ef | grep.... $LIST)&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill&lt;BR /&gt;</description>
    <pubDate>Thu, 11 Oct 2001 15:51:39 GMT</pubDate>
    <dc:creator>Bill McNAMARA_1</dc:creator>
    <dc:date>2001-10-11T15:51:39Z</dc:date>
    <item>
      <title>checking conditions</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593319#M33173</link>
      <description>Here we go again. I have a script that generates a list of running processes that meet certain criteria.  I need to see if any of the process names are on a list of processes.  To clarify, if any of these processes are on the list then I need to take additional action.  I have an if statement running in a do loop but how do I do a string comparison against a list of programs. The list is like abc,def,ghi,jkl,mno.  If the process name is any of those then I need to go to the next process for comparison. Clear as mud?  Thanks.</description>
      <pubDate>Thu, 11 Oct 2001 15:48:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593319#M33173</guid>
      <dc:creator>Scott E Smith</dc:creator>
      <dc:date>2001-10-11T15:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: checking conditions</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593320#M33174</link>
      <description>&lt;BR /&gt;function _not_running {&lt;BR /&gt;        RUNNING=$(ps -ef|grep "$0"|grep -v grep|grep -v $$|grep -v man)&lt;BR /&gt;        if [[ "$RUNNING" != "" ]]&lt;BR /&gt;        then&lt;BR /&gt;         PID=$(echo ${RUNNING} | awk {"print \$2;exit"})&lt;BR /&gt;         echo "\nERROR: The tool is already running under pid: ${PID}\n"&lt;BR /&gt;         echo "You must wait until it completes.\n"&lt;BR /&gt;         exit 1&lt;BR /&gt;        fi&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;you can modify the important bit into your loop with &lt;BR /&gt;for i in $(ps -ef | grep.... $LIST)&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Later,&lt;BR /&gt;Bill&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Oct 2001 15:51:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593320#M33174</guid>
      <dc:creator>Bill McNAMARA_1</dc:creator>
      <dc:date>2001-10-11T15:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: checking conditions</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593321#M33175</link>
      <description>in ksh:&lt;BR /&gt;&lt;BR /&gt;if [ ?( "abc" "def" "ghi" ) ]&lt;BR /&gt;then&lt;BR /&gt;  # match&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Oct 2001 16:04:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593321#M33175</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2001-10-11T16:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: checking conditions</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593322#M33176</link>
      <description>Scott,&lt;BR /&gt;&lt;BR /&gt;Consider using XPG4 version of ps. It is a very good tool for this kind of checks.&lt;BR /&gt;&lt;BR /&gt;UNIX95= ps -e -o "args" |sort &amp;gt;&amp;gt; running_procs&lt;BR /&gt;&lt;BR /&gt;You can use this output to tackle your problem&lt;BR /&gt;&lt;BR /&gt;Now you can use your list to compare what's in there.&lt;BR /&gt;&lt;BR /&gt;STAMP=0&lt;BR /&gt;for PROC in `cat my_list`&lt;BR /&gt;do&lt;BR /&gt;grep $PROC running_procs &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "PROC is running"&lt;BR /&gt;STAMP=1&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;if [ $STAMP = 1 ] (This means atleast one of                 the processes that are                there in the list is running)&lt;BR /&gt; &lt;BR /&gt;then&lt;BR /&gt;do_whatever_you_want&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Does this help?.&lt;BR /&gt;&lt;BR /&gt;-Sri</description>
      <pubDate>Thu, 11 Oct 2001 16:08:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593322#M33176</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2001-10-11T16:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: checking conditions</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593323#M33177</link>
      <description>Question, &lt;BR /&gt;Harry, Is there a bin/sh format for that example?</description>
      <pubDate>Thu, 11 Oct 2001 16:18:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593323#M33177</guid>
      <dc:creator>Scott E Smith</dc:creator>
      <dc:date>2001-10-11T16:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: checking conditions</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593324#M33178</link>
      <description>&lt;BR /&gt;ps -aef | grep  -e "abd" -e "cde" -e ....&lt;BR /&gt;&lt;BR /&gt;find processes&lt;BR /&gt;&lt;BR /&gt;ps -aef | grep -v -e "abd" -e "cde" -e ....&lt;BR /&gt;&lt;BR /&gt;Find all process except..&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Oct 2001 17:34:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593324#M33178</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2001-10-11T17:34:21Z</dc:date>
    </item>
    <item>
      <title>Re: checking conditions</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593325#M33179</link>
      <description>If someone doesn't answer that today, I'll try to answer that tomorrow morning.</description>
      <pubDate>Thu, 11 Oct 2001 19:55:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/checking-conditions/m-p/2593325#M33179</guid>
      <dc:creator>harry d brown jr</dc:creator>
      <dc:date>2001-10-11T19:55:22Z</dc:date>
    </item>
  </channel>
</rss>

