Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This is most likely a "newbie" question here. My script below used to work on solaris, but stopped working correctly right about the time I installed the most recent recommended maintenance update cluster from sun. It used to email me the contents of my pretty, edited array "@quota" using the sendmail module. Now it just emails me a blank email.
For future reference, what is the best way to take the contents of an edited array, such as in this script, and send its contents via email? I tried following the recipies in Oreilly's Perl Cookbook, but I got the same results :-(
#!/usr/local/bin/perl # use Mail::Sendmail; $mailhost = "mail_server"; $fromaddress = "me@.com"; $toaddress = "me@.com"; %mail = ( From => $fromaddress, Subject => "server Quota Report", Smtp => $mailhost, To => $toaddress, ); # Define Global Variables # Percentage Quota used that triggers a warning to the user. $warnquotapct = 25; # Netapp mixed mode filer my @quota = `rsh server_name quota report -x`; #Remove the top 3 lines from the quota output (header) shift(@quota); shift(@quota); shift(@quota); foreach $line (@quota) { chomp($line); ($ignore, $user, $vol, $tree, $used, $limit, $thresh, $ignore, $ignore +, $ignore) = split(/\s+/, $line); next unless ($user); $user = lc($user); next if ($user eq "\*"); next if ($user eq "root"); next if ($user eq "builtin\\administrators"); next if ($used <= "0") || ($used eq ""); # # Below line is for server right now limit = "-" # next if ($limit eq "-") || ($limit eq ""); # Strip out the "NT_DOMAIN\" prefix to the username if it's there. $user =~ s/NT_DOMAIN\\//; $used = $used / 1000; $quota = $quota / 1000; $limit = $limit / 1000; $usedquotapct= $used / $limit *100; $remainingquota = $limit - $used; if ($usedquotapct >= $maxquotapct ) { printf ("$user\'s disk usage \= %.2f MB.\nHas %.2f MB availabl +e.\nQuota set to: %.2f MB\n\n", $used, $remainingquota, $limit); } } print("\nSending email..."); sendmail(%mail) || print "Error: $Mail::Sendmail::error\n"; print("Complete\n");
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: 'Best way to email edited array contents?
by arden (Curate) on Feb 12, 2004 at 04:02 UTC | |
by Anonymous Monk on Feb 12, 2004 at 19:00 UTC | |
Re: 'Best way to email edited array contents?
by jlongino (Parson) on Feb 12, 2004 at 06:04 UTC | |
by Anonymous Monk on Feb 12, 2004 at 19:27 UTC | |
by Anonymous Monk on Feb 12, 2004 at 20:30 UTC | |
by l3nz (Friar) on Feb 12, 2004 at 21:03 UTC |