Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

How do I whack the output of the shell command "exim -bp" into an array?

by Spickachu (Initiate)
on Jul 19, 2000 at 14:22 UTC ( [id://23159]=perlquestion: print w/replies, xml ) Need Help??

Spickachu has asked for the wisdom of the Perl Monks concerning the following question:

I feel like this is sorta cheating. It's crude but I don't get paid enough to do anything more fancy for now!
# file: Mailq_Check.pl open STDOUT, ">mailq_check.log"; system "mailq | grep frozen"; close STDOUT; exec `perl mail_report.pl mailq_check.log`;
# file: mail_report.pl while (<>) { @array = $_; $mail_fault_cnt++; } if ( $mail_fault_cnt > 0 ) { exec `more mailq_check.log| mail -s MailQ_Error sstock\@essex.ac.u +k`; }

Replies are listed 'Best First'.
Re: How do I whack the output of the shell command
by Anonymous Monk on Dec 06, 2001 at 01:54 UTC
    Open a pipe to mail and send to output of mailq to it.
    $output = `mailq | grep frozen`; if ($output) { open(MAIL, "| mail -s sstock\@essex+.ac.uk"); print MAIL $output; close(MAIL); }
Re: How do I whack the output of the shell command
by Spickachu (Initiate) on Jul 19, 2000 at 19:31 UTC
    Sorta cheated and used the quick and easy response in the end. So it's crude but don't get paid enough to doing anything more fancy for now!
    -------------------------------------------------- <FILENAME: Mailq_Check.pl> open(STDOUT, ">mailq_check.log"); system("mailq| grep frozen"); close STDOUT; exec(`perl mail_report.pl mailq_check.log`); -------------------------------------------------- <FILENAME: mail_report.pl> while (<>) { @array = $_; $mail_fault_cnt++;} if ($mail_fault_cnt>0) { exec (`more mailq_check.log| mail -s MailQ_Error sstock\@essex +.ac.uk`);}

    Originally posted as a Categorized Answer.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://23159]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found