Why isn't this perl script working when run from Mon? It works when it's run from the command line.
#!/usr/bin/perl
use Getopt::Std;
use Text::Wrap;
use Net::SMTP;
getopts ("S:s:g:h:t:l:u");
$summary=<STDIN>;
chomp $summary;
$summary = $opt_S if (defined $opt_S);
$mailaddrs = join (',', @ARGV);
$ALERT = $opt_u ? "UP" : "DOWN";
$t = localtime($opt_t);
($wday,$mon,$day,$tm) = split (/\s+/, $t);
$MAIL .= <<EOF;<br>
From: support\@cnsp.com
To: $mailaddrs
Subject: SERVER $ALERT $opt_g [ $opt_s ] ($summary) ($wday $mon $day $tm)
X-Mailer: $0
EOF
$MAIL .= <<EOF;<br>
Server $opt_g [${opt_s}] is $ALERT. Time noticed: $t
EOF
$MAIL .= wrap ("", "", "Summary output : $summary"), "\n";
$MAIL .= <<EOF;<br>
Detailed text (if any) follows:
-------------------------------
EOF
while (<STDIN>) {
$MAIL .= $_;
}
$mailmethod = Net::SMTP->new('209.155.168.8');
$mailmethod->mail("support@cnsp.com");
$mailmethod->to($mailaddrs, { SkipBad => 1 });
$mailmethod->data($MAIL);
$mailmethod->quit();
Now the weird thing is, is that it doesn't puke any errors. |