[SunHELP] Shell script
Heshmati, Sardar
sunhelp at sunhelp.org
Thu Jan 25 13:10:06 CST 2001
Here is a simple little perl script that does the job.
#!/bin/perl -w
#
# check_fs.pl
######
$admin = "9255555555\@messaging.nextel.com" ; # Admin's
Nextel phone number or email
chomp($hostname = `/bin/hostname`) ; # Hostname
chomp($date = `/bin/date`) ; # Date
@df = `/bin/df -kl` ; # Partition info
$th="85"; # Disk usage threshold
foreach $line (@df) {
next if $line =~ /Filesystem/; # Skip the header line
$line =~ s/\%//; # Yank the % sign so we can compare
it to threshold
($partition, undef, undef, undef, $capacity, $mount) = split ('\s+',
$line);
next if $mount =~ /cdrom/ ; # Skip CD-ROM drive
if ($capacity >= $th) {
@part = split ("\/", $partition) ;
`echo "$hostname: $part[$#part] is at $capacity\%
capatity\n$date\n" | /bin/mailx $admin` ;
}
}
-----Original Message-----
From: walubank at hotmail.com [mailto:walubank at hotmail.com]
Sent: Wednesday, January 24, 2001 12:08 PM
To: sunhelp at sunhelp.org
Subject: [SunHELP] Shell script
Does anybody have a shell script that will monitor the file system and send
a mail to root when they get to 80%
Thanks
Wally
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
_______________________________________________
SunHELP maillist - SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp
More information about the SunHELP
mailing list