Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

RE: Full Filesystem Notification

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


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 23: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
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-18 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found