Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
No such thing as a small change
 
PerlMonks  

RE: Full Filesystem Notification

by prodevel (Scribe)
on Jun 30, 2000 at 19:26 UTC ( [id://20657]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to RE: Full Filesystem Notification
in thread Full Filesystem Notification

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

Replies are listed 'Best First'.
Whoops - here's the script
by prodevel (Scribe) on Jun 30, 2000 at 19:46 UTC
    #!/usr/bin/ksh 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 76 then mailx -s "Filesystem: $filesys is ${full}% full!!!" pager@pagerhost.com <<EOF $dfline EOF fi done

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://20657]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.