Re: Script that mionitors a file size and notifies you if too big

From: Jonathan Portman (Jonathan.Portman@MPRC.CO.UK)
Date: Thu Sep 26 2002 - 04:17:58 EDT


Thanks Steve,

I have now managed to get a good script going thanks to a colleague of mine.

-----Original Message-----
From: Steve Argersinger [mailto:sargersi@RUAN.COM]
Sent: 24 September 2002 19:02
To: aix-l@Princeton.EDU
Subject: Re: Script that mionitors a file size and notifies you if too big

Assign the contents of the ls command to a variable and do a comparison on
the variable.

i.e. x=`ls -la ...`
if [ $x > 1.5 ]; then
cat help | mail loginid@domain.com <mailto:loginid@domain.com>
fi

Steve Argersinger
Ruan Transportation

-----Original Message-----
From: Jonathan Portman [mailto:Jonathan.Portman@MPRC.CO.UK]
Sent: Tuesday, September 24, 2002 11:45 AM
To: aix-l@Princeton.EDU
Subject: Script that mionitors a file size and notifies you if too big

Hello,
        I am currently trying to devise a script which monitors a size of a
file. When it reaches around 1.5GB I need to be notified so that action can
be taken.
At the moment I have got this far with the script:
#/usr/bin/ksh
while true
do
ls -la /usr/servtest/servtran.log |awk '{print "servtran.log size is
"$5/1024/10
24" MB"'}
sleep 3
done
The above obviously executes a while true by just showing the filesize. But
I'm stuck with the filesize greater than 1.5GB and to notify me of the size.
Any help on this would be much appreciated.
Regards,
Jon.

********************************************************************
Disclaimer :-
This email is confidential and intended solely for the use of the
individual to whom it is addressed. Any views or opinions are solely
those of the author and do not necessarily represent those of the
Caudwell Distribution Group (2020 Logistics Ltd,
Dextra Accessories Ltd, The Mobile Phone Repair Company Ltd).
If you are not the intended recipient, be advised that you have
received this email in error and that any use, dissemination,
forwarding, printing or copying is strictly prohibited. If you
have received this email in error please delete it from your system
and notify the sender immediately.
********************************************************************

********************************************************************
Disclaimer :-
This email is confidential and intended solely for the use of the
individual to whom it is addressed. Any views or opinions are solely
those of the author and do not necessarily represent those of the
Caudwell Distribution Group (2020 Logistics Ltd,
Dextra Accessories Ltd, The Mobile Phone Repair Company Ltd).
If you are not the intended recipient, be advised that you have
received this email in error and that any use, dissemination,
forwarding, printing or copying is strictly prohibited. If you
have received this email in error please delete it from your system
and notify the sender immediately.
********************************************************************



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:13 EDT