<?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: Scripting Assistance in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046645#M94154</link>
    <description>HI (again) Jay:&lt;BR /&gt;&lt;BR /&gt;I maeant to add:&lt;BR /&gt;&lt;BR /&gt;Adjust the loop timer as you see fit and run the script as a background process or eliminate the loop ('while true') and simply 'cron' the script to run periodically.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Mon, 30 Jul 2007 15:51:17 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2007-07-30T15:51:17Z</dc:date>
    <item>
      <title>Scripting Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046640#M94149</link>
      <description>Hi.&lt;BR /&gt;&lt;BR /&gt;Scripting Newbie here.  Just looking for a little script to monitor a specific file; when this file goes over a certain size (NOT percent used as in a bdf script), it will send an email.  Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Jay</description>
      <pubDate>Mon, 30 Jul 2007 15:12:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046640#M94149</guid>
      <dc:creator>Jay Core</dc:creator>
      <dc:date>2007-07-30T15:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046641#M94150</link>
      <description>It's rather simple. I would probably set it up as a cron job to run every 10 minutes or so:&lt;BR /&gt;&lt;BR /&gt;------------------------------&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;typeset FNAME=/aaa/bbb/myfile&lt;BR /&gt;typeset -i MAXSIZE=1000000 &lt;BR /&gt;typeset ADDRESS="mickey@mouse.com"&lt;BR /&gt;typeset SUBJECT="Filesize Notification"&lt;BR /&gt;typese SZ=""&lt;BR /&gt;&lt;BR /&gt;export PATH=${PATH}:/usr/bin&lt;BR /&gt;&lt;BR /&gt;if [[ -f "${FNAME}" ]]&lt;BR /&gt;  then&lt;BR /&gt;    SZ=$(ls -l "${FNAME}" | awk '{print $5}')&lt;BR /&gt;    if [[ ${SZ} -gt ${MAXSIZE} ]]&lt;BR /&gt;      then&lt;BR /&gt;        echo "File ${FNAME} size ${SZ} bytes." | mailx -s "${SUBJECT}" ${ADDRESS}&lt;BR /&gt;      fi&lt;BR /&gt;  fi&lt;BR /&gt;&lt;BR /&gt;-----------------------------------------&lt;BR /&gt;</description>
      <pubDate>Mon, 30 Jul 2007 15:29:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046641#M94150</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-07-30T15:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046642#M94151</link>
      <description>One approach...&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;FILEDIR=/my/file/path&lt;BR /&gt;FILENAME=myfile&lt;BR /&gt;FULLPATH=${FILEDIR}/${FILENAME}&lt;BR /&gt;WARNSIZE=1024c&lt;BR /&gt;FOUND=$(find ${FILEDIR} -name ${FILENAME} -size +${WARNSIZE})&lt;BR /&gt;&lt;BR /&gt;if [ "${FULLPATH}" = "${FOUND}" ]&lt;BR /&gt;then&lt;BR /&gt;  mailx -s "${FULLPATH} Warning" username@company.com &amp;lt;&lt;EOM&gt;&lt;/EOM&gt;${FULLPATH} has exceeded threshold of ${WARNSIZE}. Take corrective action.&lt;BR /&gt;EOM&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Obviously, change the dummy values and adjust the WARNSIZE value to fit your needs. Schedule to run via cron at the desired interval.</description>
      <pubDate>Mon, 30 Jul 2007 15:29:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046642#M94151</guid>
      <dc:creator>Jeff_Traigle</dc:creator>
      <dc:date>2007-07-30T15:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046643#M94152</link>
      <description>You can create a script that is run from cron every so often and sends an email once the size is over the threshold. The test can be as simple as getting the size of the file from the command line by lsting the contents of the directory it is in. For ex. if the notification should be sent after the file size exceeds 1MB then:&lt;BR /&gt;&lt;BR /&gt;# ll -art file_name | awk '$5 &amp;gt; 1048576'</description>
      <pubDate>Mon, 30 Jul 2007 15:36:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046643#M94152</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-07-30T15:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046644#M94153</link>
      <description>Hi Jay:&lt;BR /&gt;&lt;BR /&gt;# cat ./monitor&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;typeset -i SIZE=$1&lt;BR /&gt;typeset -i CURR=0&lt;BR /&gt;typeset    FILE=$2&lt;BR /&gt;while true&lt;BR /&gt;do&lt;BR /&gt;    CURR=`wc -c &amp;lt; ${FILE}`&lt;BR /&gt;    if [ ${CURR} -gt ${SIZE} ]; then&lt;BR /&gt;        mailx -s "${FILE} is larger than ${SIZE} characters" root &amp;lt; /dev/null&lt;BR /&gt;        exit&lt;BR /&gt;    fi&lt;BR /&gt;    sleep 10&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;...Run as:&lt;BR /&gt;&lt;BR /&gt;# ./monitor 1000 myfile&lt;BR /&gt;&lt;BR /&gt;...that is, pass the maximum size in characters you want the file to grow to until an email alert is generated (here, to 'root') along with the name of the file that you want monitored.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 30 Jul 2007 15:48:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046644#M94153</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-07-30T15:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046645#M94154</link>
      <description>HI (again) Jay:&lt;BR /&gt;&lt;BR /&gt;I maeant to add:&lt;BR /&gt;&lt;BR /&gt;Adjust the loop timer as you see fit and run the script as a background process or eliminate the loop ('while true') and simply 'cron' the script to run periodically.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 30 Jul 2007 15:51:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046645#M94154</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-07-30T15:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting Assistance</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046646#M94155</link>
      <description>Beautiful - thanks all.</description>
      <pubDate>Mon, 30 Jul 2007 16:27:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-assistance/m-p/4046646#M94155</guid>
      <dc:creator>Jay Core</dc:creator>
      <dc:date>2007-07-30T16:27:48Z</dc:date>
    </item>
  </channel>
</rss>

