Date: Mon, 15 Sep 2003 14:28:48 -0500 From: "Charles Howse" <chowse@charter.net> To: <freebsd-questions@freebsd.org> Subject: RE: drive space shell script help ? Message-ID: <003801c37bbf$964b67c0$04fea8c0@moe>
next in thread | raw e-mail | index | archive | help
The more I play with your script, the more fun it becomes.
#!/bin/sh
# this is a script to check drive space and email HSD dept.
#
cd ~bbailey
rm drvspc.txt # Once I'm in ~bbailey, I don't need the complete path to
any files there.
df -k |=20
# You have to get rid of the word 'Capacity' or your comparison will
fail,
grep -v Capacity |
# There's no need to check the /proc filesystem, it'll always be full,
grep -v /proc |=20
awk '{print$5}' |=20
# You have to use sed to eliminate the % from df -k or the comparison
will fail.
sed -e 's/%//' > drvspc.txt=20
cat drvspc.txt |=20
while read i
do
if [ $i -gt 89 ] ; then
mail -s "check drive space on core" bbailey@whatever.com
fi
done
# Quotes not necessary when echoing a single word, but I wouldn't do
this, you
# might want to schedule this with cron and it'll clutter up your screen
# if you tell it to say 'done' every time it runs.
echo done=20
exit 0
Thanks,
Charles
Got a computer with idle CPU time?
Join SETI@home and help make history!
http://setiathome.ssl.berkeley.edu/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?003801c37bbf$964b67c0$04fea8c0>
