<?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 Newbie Brain Freeze Simple If Question in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868009#M706632</link>
    <description>I'm doing a bdf on my HP-UX 11.i box.  I then awk out the % used ($1) and the mount point($2).  I want an if statment that goese something like this.&lt;BR /&gt;If $1 is &amp;gt; 80% AND (!grep "/opt/sc" $2) then do something&lt;BR /&gt;&lt;BR /&gt;Can anyone help me with this.  I've got brain freeze.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Scott</description>
    <pubDate>Thu, 28 Oct 2004 14:10:53 GMT</pubDate>
    <dc:creator>Scott Frye_1</dc:creator>
    <dc:date>2004-10-28T14:10:53Z</dc:date>
    <item>
      <title>Newbie Brain Freeze Simple If Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868009#M706632</link>
      <description>I'm doing a bdf on my HP-UX 11.i box.  I then awk out the % used ($1) and the mount point($2).  I want an if statment that goese something like this.&lt;BR /&gt;If $1 is &amp;gt; 80% AND (!grep "/opt/sc" $2) then do something&lt;BR /&gt;&lt;BR /&gt;Can anyone help me with this.  I've got brain freeze.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Scott</description>
      <pubDate>Thu, 28 Oct 2004 14:10:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868009#M706632</guid>
      <dc:creator>Scott Frye_1</dc:creator>
      <dc:date>2004-10-28T14:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Brain Freeze Simple If Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868010#M706633</link>
      <description>if [ $1 -gt 80 -a $2 != "/opt/sc" ]; then&lt;BR /&gt;&lt;BR /&gt;whatever you want.&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Thu, 28 Oct 2004 14:19:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868010#M706633</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-10-28T14:19:19Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Brain Freeze Simple If Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868011#M706634</link>
      <description>$2 will contain&lt;BR /&gt;/patrol&lt;BR /&gt;/opt&lt;BR /&gt;/opt/supra2/savelog&lt;BR /&gt;/opt/supra2/dbutil&lt;BR /&gt;/opt/sct2/dbl1&lt;BR /&gt;/opt/sct2/db01&lt;BR /&gt;/opt/sct1/dbl1&lt;BR /&gt;/opt/sct1/db01&lt;BR /&gt;/opt/scp1/dbl2&lt;BR /&gt;&lt;BR /&gt;This is why I want to grep $2 and look for "/opt/sc".  Can this be included in the statement?&lt;BR /&gt;&lt;BR /&gt;Scott</description>
      <pubDate>Thu, 28 Oct 2004 14:22:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868011#M706634</guid>
      <dc:creator>Scott Frye_1</dc:creator>
      <dc:date>2004-10-28T14:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Brain Freeze Simple If Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868012#M706635</link>
      <description>try this:&lt;BR /&gt;&lt;BR /&gt;if echo $2|grep "/opt/sc"&amp;gt;/dev/null; then&lt;BR /&gt;   if [[ "$1" -gt 80 ]]; then&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;mark&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Oct 2004 14:25:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868012#M706635</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2004-10-28T14:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Brain Freeze Simple If Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868013#M706636</link>
      <description>test "$1 -gt 80 -a $2 != "/opt/sc"" &amp;amp;&amp;amp; "whatever you want"&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Thu, 28 Oct 2004 14:26:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868013#M706636</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-10-28T14:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Brain Freeze Simple If Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868014#M706637</link>
      <description>for in i in $(echo $2)&lt;BR /&gt;do&lt;BR /&gt;test "$1 -gt 80 -a $2 != "/opt/sc"" &amp;amp;&amp;amp; "whatever you want"test "&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Anil</description>
      <pubDate>Thu, 28 Oct 2004 14:32:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868014#M706637</guid>
      <dc:creator>RAC_1</dc:creator>
      <dc:date>2004-10-28T14:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Brain Freeze Simple If Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868015#M706638</link>
      <description>bdf display will give format as,&lt;BR /&gt;Filesystem          kbytes    used   avail %used Mounted on&lt;BR /&gt;&lt;BR /&gt;so that,&lt;BR /&gt;&lt;BR /&gt; we will be having $1 - %&lt;BR /&gt;                   $2 - FS then,&lt;BR /&gt;&lt;BR /&gt; bdf | awk '!/^Filesystem/ { print $5" "$1 }' | while read per fs; do&lt;BR /&gt;&lt;BR /&gt; if [[ $per -gt 80% &amp;amp;&amp;amp; $fs = "/opt/sc" ]]&lt;BR /&gt; then&lt;BR /&gt; &lt;BR /&gt;   # do something&lt;BR /&gt; fi&lt;BR /&gt; done&lt;BR /&gt;&lt;BR /&gt; Else simply with awk as,&lt;BR /&gt;&lt;BR /&gt;  bdf | awk '!/^Filesystem/ { if ( $5 &amp;gt; 80 &amp;amp;&amp;amp; $1 == "/opt/sc") &lt;EXECUTE operation=""&gt; }'&lt;BR /&gt;&lt;BR /&gt;HTH.&lt;BR /&gt; &lt;BR /&gt;&lt;/EXECUTE&gt;</description>
      <pubDate>Fri, 29 Oct 2004 07:49:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868015#M706638</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2004-10-29T07:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Newbie Brain Freeze Simple If Question</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868016#M706639</link>
      <description>Here is what I am doing.  I'm running bdf to a file for multiple uses.  My output goes to an html file that gives us a dashboard look at our system health.  I we have yellow or red lights, we know there are issues we need to look at.  We are removing some Oracle filesystems from the check because they are at 100% but we are told they are fine.&lt;BR /&gt;&lt;BR /&gt;Thanks for all the input and now for my sloppy code.&lt;BR /&gt;&lt;BR /&gt;   bdf &amp;gt; /home/sysadmin/get_diskusage&lt;BR /&gt;   awk '!/^Filesystem/ { print $5" "$6 }' /home/sysadmin/get_diskusage | while read preper fs; do&lt;BR /&gt;     per=`echo "$preper" | awk '{print $1}' | cut -f1 -d'%'`&lt;BR /&gt;     dugreen=1&lt;BR /&gt;     if [ $per -gt 85 ]&lt;BR /&gt;     then if [ `echo ${fs} | grep "/opt/sc"` ]&lt;BR /&gt;          then dugreen=1&lt;BR /&gt;          else duyellow=1&lt;BR /&gt;          fi&lt;BR /&gt;     fi&lt;BR /&gt;&lt;BR /&gt;     if [ $per -gt 90 ]&lt;BR /&gt;     then if [ `echo ${fs} | grep "/opt/sc"` ]&lt;BR /&gt;          then dugreen=1&lt;BR /&gt;          else dured=1&lt;BR /&gt;          fi&lt;BR /&gt;     fi&lt;BR /&gt;   done&lt;BR /&gt;&lt;BR /&gt;   if [ $dured ]&lt;BR /&gt;   then IMG=redlight&lt;BR /&gt;   elif [ $duyellow ]&lt;BR /&gt;   then IMG=yellowlight&lt;BR /&gt;   else IMG=greenlight&lt;BR /&gt;   fi&lt;BR /&gt;&lt;BR /&gt;   print_image</description>
      <pubDate>Fri, 29 Oct 2004 09:19:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/newbie-brain-freeze-simple-if-question/m-p/4868016#M706639</guid>
      <dc:creator>Scott Frye_1</dc:creator>
      <dc:date>2004-10-29T09:19:53Z</dc:date>
    </item>
  </channel>
</rss>

