#!/usr/bin/perl
foreach (`df -h|grep /dev/hda11`) {
split();
# our $total = $_[1];
# our $used = $_[2];
our $free = $_[3];
if ($free =~ /M/){
$free=~ s/M//;
print $free."\n";
if ($free <= 10) {
$mesg = "the space left is $free";
print("low on space.\n");
system('mailx','-s','"Space
low"','[EMAIL PROTECTED]','<',qq($mesg)) == 0 or die "Couldn't
mail $!";
}
}
}
this isn't working....i have to press Ctrl+D to send the mail.....this script will be cronned so i need the mail to be send automatically......what can i do ?? alternatives???
thnx in adv Saurabh
Use one of the many modules found on CPAN for mail handling. Handling mail manually like above is a very bad idea. Or if this is really just going to be cron'd then just print to STDOUT, anything cron sees on stdout it will mail to the user running the script, set up a proper .forward and everything should just work.
http://danconia.org
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>