Thanks very much, Shendal! Much appreciated. Actually, I probably should have gone over the code before submitting. FYI here's another version in pure ksh I wrote for a Oracle DBA friend of mine that didn't want to install Perl if you're interested. Bit more condensed.
Hope I don't get into any trouble for posting shell! =)
#!/usr/bin/ksh
pct=90
x=0
for filesys in `df -k | awk '{print $1}'`
do
x=`expr $x + 1`
dfline=`df -k | head -$x | tail -1`
full=`echo $dfline | awk '{print $5}' | sed 's/%//g' | egrep -v capacity`
if
$full -gt pct
then
mailx -s "Filesystem: $filesys is ${full}% full!!!" mail@mailhost.com <<EOF
$dfline
EOF
mailx -s "Filesystem: $filesys is ${full}% full!!!" pager@pagerhost.com <<EOF
$dfline
EOF
fi
done
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.