Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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 ( #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: open STDOUT, ">mailq_check.log"; system "mailq | grep frozen"; close STDOUT; exec `perl mailq_check.log`;
# file: while (<>) { @array = $_; $mail_fault_cnt++; } if ( $mail_fault_cnt > 0 ) { exec `more mailq_check.log| mail -s MailQ_Error sstock\ +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\"); print MAIL $output; close(MAIL); }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://23159]
and the monastery is silent...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2017-11-25 05:30 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (355 votes). Check out past polls.