David,
How does this handle mount CD's as they show up as 100% used on the df
command?
David Stabler
<dstabler@MORRISON To: ADSM-L AT VM.MARIST DOT EDU
HOMES.COM> cc:
Sent by: "ADSM: Subject: Re: SCRIPT FOR df -k
ALERTS ATTACHED
Dist Stor Manager"
<[email protected].
EDU>
12/09/02 12:44
Please respond to
"ADSM: Dist Stor
Manager"
> praveenkumark AT VYSBANK DOT COM wrote on 09/12/02 02:58AM
> .if someone can help me in completing this task using a single
> script it would be helpful....
How about....... (assuming you have /bin/ksh)
#!/bin/sh
#
# this program scans the filesystems for ones that exceed a maximum
# percentage used. The parameter is set inline, but could be called
# as a passed parameter, but the command below would need to be
# changed to MAXPCT=${1}
#
# set MAXPCT to size to watch for
#
MAXPCT=80
#
# run df command, remove line starting with "Filesys..." as it isn't a
filesystem but
# a header. Read the input values for reuse in output commands in a
loop that
# runs until we are out of filesystems to scan.
#
# ASSUMPTION: output of df-k command looks like this:
# /dev/lvname blocksize freeblocks pctused inodes_used
pctinodes_used mountpoint
#
#
df -k | grep -v "^Filesys" | \
while read lvol size free pctu iused piused filesys
do
#
# in order to strip off the %, make it the 'input field seperator',
which means
# that the first value will be the actual number. Using a variable
inline like this
# only sets it for the program running, so the IFS is only temporarily
set to %
# and only for the read process...
#
echo ${pctu} | IFS=% read pctval etc
#
# test to see if too big....
#
if [ ${pctval} -gt ${MAXPCT} ]; then
echo "${filesys} exceeds ${MAXPCT}% used (${pctval})"
#
# additional information could be printed, like the logical volume
information,
# free space, etc....but, we won't do it just yet. Later revision,
maybe.
#
fi
done
exit 0
David Stabler, CATE/AIX, CNCE
Senior Systems Analyst
*************************************************************************
This e-mail may contain confidential information or be privileged. It is
intended to be read and used only by the named recipient(s). If you are not the
intended recipient(s) please notify us immediately so that we can make
arrangements for its return: you should not disclose the contents of this
e-mail to any other person, or take any copies. Unless stated otherwise by an
authorised individual, nothing contained in this e-mail is intended to create
binding legal obligations between us and opinions expressed are those of the
individual author.
The CIS marketing group, which is regulated for Investment Business by the
Financial Services Authority, includes:
Co-operative Insurance Society Limited Registered in England number 3615R - for
life assurance and pensions
CIS Unit Managers Limited Registered in England and Wales number 2369965 - for
unit trusts and PEPs
CIS Policyholder Services Limited Registered in England and Wales number
3390839 - for ISAs and investment products bearing the CIS name
Registered offices: Miller Street, Manchester M60 0AL Telephone
0161-832-8686 Internet http://www.cis.co.uk E-mail cis AT cis.co DOT uk
CIS Deposit and Instant Access Savings Accounts are held with The Co-operative
Bank p.l.c., registered in England and Wales number 990937, P.O. Box 101, 1
Balloon Street, Manchester M60 4EP, and administered by CIS Policyholder
Services Limited as agent of the Bank.
CIS is a member of the General Insurance Standards Council
CIS & the CIS logo (R) Co-operative Insurance Society Limited
********************************************************************************
|