<?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: while bdf ........... in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876209#M707883</link>
    <description>Just noticed a typo: there should be a pipe symbol in front of tail -1 in the examples.</description>
    <pubDate>Mon, 20 Dec 2004 21:26:43 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2004-12-20T21:26:43Z</dc:date>
    <item>
      <title>while bdf ...........</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876205#M707879</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I have a file system that shoots up when it is being written to.&lt;BR /&gt;&lt;BR /&gt;I want to write a small program that I can run while on shift to monitor the file system:&lt;BR /&gt;&lt;BR /&gt;can anyone help?  I was going to use a while loop?&lt;BR /&gt;&lt;BR /&gt;Ta</description>
      <pubDate>Mon, 20 Dec 2004 18:44:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876205#M707879</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2004-12-20T18:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: while bdf ...........</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876206#M707880</link>
      <description>Somethings like this should work:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;bdf /filesystem&lt;BR /&gt;sleep 30&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Save that with some filename.  Do a 'chmod 700 filename' on it and then invoke as:&lt;BR /&gt;&lt;BR /&gt;# ./filename&lt;BR /&gt;&lt;BR /&gt;That will run a bdf every 30 seconds.  Just change the sleep command to run it more or less often.  Just &lt;CTRL&gt;-C to break  out of it.&lt;BR /&gt;&lt;/CTRL&gt;</description>
      <pubDate>Mon, 20 Dec 2004 20:32:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876206#M707880</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2004-12-20T20:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: while bdf ...........</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876207#M707881</link>
      <description>ok,&lt;BR /&gt;&lt;BR /&gt;almost what I'm looking for,&lt;BR /&gt;&lt;BR /&gt;when the bdf reach's 70% i need it to mail me&lt;BR /&gt;&lt;BR /&gt;# bdf |grep /data/oracle/exports| awk '{print $5;getline}'&lt;BR /&gt;&lt;BR /&gt;this outputs filesystem %&lt;BR /&gt;&lt;BR /&gt;when it is over 70% i want it to mail me&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;read&lt;BR /&gt;bdf |grep /data/oracle/exports| awk '{print $5;getline}'&lt;BR /&gt;do&lt;BR /&gt;if ??&lt;BR /&gt;then &lt;BR /&gt;echo "alert" |mail user@address&lt;BR /&gt;fi&lt;BR /&gt;done.&lt;BR /&gt;&lt;BR /&gt;Am I on the right lines?&lt;BR /&gt;&lt;BR /&gt;cheers&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Dec 2004 20:53:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876207#M707881</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2004-12-20T20:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: while bdf ...........</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876208#M707882</link>
      <description>Your sample script:&lt;BR /&gt; &lt;BR /&gt;&amp;gt; while true&lt;BR /&gt;&amp;gt; read&lt;BR /&gt;&amp;gt; bdf |grep /data/oracle/exports| awk '{print $5;getline}'&lt;BR /&gt;&amp;gt; do&lt;BR /&gt;&amp;gt; if ??&lt;BR /&gt;&amp;gt; then&lt;BR /&gt;&amp;gt; echo "alert" |mail user@address&lt;BR /&gt;&amp;gt; fi&lt;BR /&gt;&amp;gt; done&lt;BR /&gt; &lt;BR /&gt;There are several problems. The first is that running this script with no delays will absolutely kill all performance on your system. And of course, you'll get THOUSANDS of email messages in just a few minutes because the script doesn't exit after the email, or change the limit.&lt;BR /&gt; &lt;BR /&gt;bdf is a VERY invasive command that (as written) searches every mounted filesystem to analyze all the current space. This includes NFS mountpoints, CDROMs, everything. So start by eliminating your grep and use a seldom-used feature of bdf:&lt;BR /&gt; &lt;BR /&gt;bdf /data/oracle/exports&lt;BR /&gt; &lt;BR /&gt;Now you'll get just one line with a header (and a much lower load on the system). To see just the last line, add tail -1 as in:&lt;BR /&gt; &lt;BR /&gt;bdf /data/oracle/exports | tail -1&lt;BR /&gt; &lt;BR /&gt;Then you can drop awk and use shell builtins to parse the bdf line like this:&lt;BR /&gt; &lt;BR /&gt;bdf /data/oracle/exports tail -1 | read SRC SIZ USED AVAIL PCT MNT&lt;BR /&gt; &lt;BR /&gt;Now the variable PCT has the percentage string. Run it through tr to remove the % and now you can test the result:&lt;BR /&gt; &lt;BR /&gt;echo $PCT | tr -d %&lt;BR /&gt; &lt;BR /&gt;So your script is now:&lt;BR /&gt; &lt;BR /&gt;LIMIT=70&lt;BR /&gt;while :&lt;BR /&gt;do&lt;BR /&gt;bdf /data/oracle/exports tail -1 | read SRC SIZ USED AVAIL PCT MNT&lt;BR /&gt;if [ $(echo $PCT | tr -d %) -gt $LIMIT ]&lt;BR /&gt;then&lt;BR /&gt;echo "alert" |mail user@address&lt;BR /&gt;exit&lt;BR /&gt;fi&lt;BR /&gt;sleep 600&lt;BR /&gt;done&lt;BR /&gt; &lt;BR /&gt;So this script will check bdf every 300 seconds (10 minutes) and send you one email when it goes over $LIMIT (70%). This is a very common sysadmin task and should be run on all the filesystems on a production server, not just the Oracle data. If /var fills up, a *LOT* of things will instantly break.</description>
      <pubDate>Mon, 20 Dec 2004 21:24:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876208#M707882</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-12-20T21:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: while bdf ...........</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876209#M707883</link>
      <description>Just noticed a typo: there should be a pipe symbol in front of tail -1 in the examples.</description>
      <pubDate>Mon, 20 Dec 2004 21:26:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876209#M707883</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-12-20T21:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: while bdf ...........</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876210#M707884</link>
      <description>brilliant - thanks for your help this has worked a treat and also has help widen my little scripting knowledge!&lt;BR /&gt;&lt;BR /&gt;lawzo</description>
      <pubDate>Mon, 20 Dec 2004 21:38:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/while-bdf/m-p/4876210#M707884</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2004-12-20T21:38:27Z</dc:date>
    </item>
  </channel>
</rss>

