RE: script to check file size and date stamp

From: Vijay Raghavan (Vijay_Raghavan01@infosys.com)
Date: Tue May 20 2003 - 07:29:22 EDT


Thanks to MacDonell

This works fine and is a good solution

Sorry I missed the bit about the alarm, you could include that with

#!/bin/sh
FILE=<file path>
SIZE=0
while [ 0 ]
do
  SIZE=`ls -l $FILE | awk '{print $5}'`
  DATE=`ls -l $FILE | awk '{print $6, $7, $8}'`
  if [ $SIZE -eq 0 ]
  then
    OSIZE=$SIZE
  else
    if [ $OSIZE -ne $SIZE ]
    then
      mailx -s "Alarm: change in file size" user@domain < "The size of
<file> changed to $SIZE bytes at $DATE"
      exit 1
    fi
  fi
  sleep 300
done

exit 0

Dennis

-----Original Message-----
From: Vijay Raghavan [mailto:Vijay_Raghavan01@infosys.com]
Sent: Tuesday, 20 May 2003 14:40
To: sunmanagers@sunmanagers.org
Subject: script to check file size and date stamp

Hi gurus

I need a script to check the date stamp and the size of a file continoulsy
every 5 minutes and give an alarm

if anything changes in that file.

Will summarize

VIJAY
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:26:26 EDT