<?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: file size alert in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904020#M936033</link>
    <description>thats great - thanks!</description>
    <pubDate>Thu, 13 Feb 2003 17:45:25 GMT</pubDate>
    <dc:creator>Michael Campbell</dc:creator>
    <dc:date>2003-02-13T17:45:25Z</dc:date>
    <item>
      <title>file size alert</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904014#M936027</link>
      <description>Hi,&lt;BR /&gt;Does anybody know of a script which will send me an email when a file reaches a certain size. we need to know when a dump file nears 2GB. &lt;BR /&gt;&lt;BR /&gt;Any ideas ?</description>
      <pubDate>Thu, 13 Feb 2003 16:21:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904014#M936027</guid>
      <dc:creator>Michael Campbell</dc:creator>
      <dc:date>2003-02-13T16:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: file size alert</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904015#M936028</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;just an idea:&lt;BR /&gt;&lt;BR /&gt;FILE=test&lt;BR /&gt;while :&lt;BR /&gt;do&lt;BR /&gt;ls -nodg $FILE | awk '{if($3 &amp;gt; 1800000000)exit 0; exit 1}'&lt;BR /&gt;if [ $? = 0 ]&lt;BR /&gt;then&lt;BR /&gt;echo "File $FILE has reached 1800000000 Bytes !"|mail user@domain&lt;BR /&gt;exit 0&lt;BR /&gt;fi&lt;BR /&gt;sleep 60&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Thu, 13 Feb 2003 16:41:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904015#M936028</guid>
      <dc:creator>Andreas Voss</dc:creator>
      <dc:date>2003-02-13T16:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: file size alert</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904016#M936029</link>
      <description>The easiest way to do this is to write a script to check this, and run it in cron. Here's a quickie&lt;BR /&gt;&lt;BR /&gt;/usr/bin/ksh&lt;BR /&gt;FFILE=/somepath/somefile&lt;BR /&gt;FSIZE=`ll $FFILE|awk '{ print $5 }'`&lt;BR /&gt;CSIZE=`echo $FSIZE/1048576|bc`&lt;BR /&gt;if test "CSIZE" -gt "2048"&lt;BR /&gt;then&lt;BR /&gt;     echo "$FFILE is now larger than 2GB"|mailx -s "$FFILE Size error" root@yourhost&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Dividing FSIZE by 1045876 gets around the fact that the test command freaks out when dealing with numbers larger than 2,147,483,647 (2^30-1).&lt;BR /&gt;&lt;BR /&gt;You could put this in a continuous loop by and not using cron by inserting the above lines between:&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;.......(insert above lines here)&lt;BR /&gt;.......sleep 60 (or some other number)&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Good Luck&lt;BR /&gt;Chris&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Feb 2003 16:52:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904016#M936029</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2003-02-13T16:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: file size alert</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904017#M936030</link>
      <description>depending on how you want to do it&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#1&lt;BR /&gt;&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;SIZE=ll /etc/fstab|cut -c 35-44&lt;BR /&gt;&lt;BR /&gt;if [[ $SIZE -ge ##### ]]&lt;BR /&gt;then&lt;BR /&gt;cat warningmessagefile |sendmail -v you@your.mail&lt;BR /&gt;break&lt;BR /&gt;fi&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;this will constantly till the file passes the limmit you set (#####) then mail you 1x and stop&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;or you can make a cron job&lt;BR /&gt;&lt;BR /&gt;SIZE=ll /etc/fstab|cut -c 35-44&lt;BR /&gt;&lt;BR /&gt;if [[ $SIZE -ge ##### ]]&lt;BR /&gt;then&lt;BR /&gt;cat warningmessagefile |sendmail -v you@your.mail&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;and schedule it to run at whatever intervals you like&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Jim&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Feb 2003 16:55:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904017#M936030</guid>
      <dc:creator>James Odak</dc:creator>
      <dc:date>2003-02-13T16:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: file size alert</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904018#M936031</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;EMAIL=your_email@domain&lt;BR /&gt;FILE=your_file_name&lt;BR /&gt;LIMIT=1500000000&lt;BR /&gt;SIZE=`ls -l $FILE|awk '{ print $5 }'`&lt;BR /&gt;if [ $SIZE -gt $LIMIT ]&lt;BR /&gt;then&lt;BR /&gt;   mailx -s "Message Subject" $EMAIL &amp;lt; /dev/null&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Rgds.</description>
      <pubDate>Thu, 13 Feb 2003 17:08:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904018#M936031</guid>
      <dc:creator>Jose Mosquera</dc:creator>
      <dc:date>2003-02-13T17:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: file size alert</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904019#M936032</link>
      <description>&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;FILE="your_file"&lt;BR /&gt;MAX=2000000 # 2 gig measured in kbytes&lt;BR /&gt;SIZE=`du -sk $FILE`&lt;BR /&gt;if [ $SIZE -ge $MAX ] ;  then&lt;BR /&gt;    echo "$FILE too large"&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;You might want to change max size to catch before it actually reaches 2 gig, maybe 1990000. You could cron this script every couple of minutes.&lt;BR /&gt;&lt;BR /&gt;Steve&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Feb 2003 17:41:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904019#M936032</guid>
      <dc:creator>Steve Labar</dc:creator>
      <dc:date>2003-02-13T17:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: file size alert</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904020#M936033</link>
      <description>thats great - thanks!</description>
      <pubDate>Thu, 13 Feb 2003 17:45:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/file-size-alert/m-p/2904020#M936033</guid>
      <dc:creator>Michael Campbell</dc:creator>
      <dc:date>2003-02-13T17:45:25Z</dc:date>
    </item>
  </channel>
</rss>

