I have a piece of code that runs fine via command line but does not work from cron. Open a pipe to read a select from mysql. open multiple processes to read output from that select. Can somebody help out?
my $logdir = "piperead.$str.log"; open LOG, ">$logdir"; eval { open WP, '-|', "/apps/mysql/bin/mysql -hhost -pxxxxx -uxxxxx - +D mysearch_retention -q -e 'select entry_week, week_num, cbid,live, s +earching, entry_week_total, tot_search, ta, part from mysearch_part_t +rack' "; open RP1, '|-', "perl bin/retention_mywebsearch.pl " or die " +can't fork retention_mywebsearch.pl -$! \n"; open RP2, '|-', "perl report.pl" or die "can't fork report2.p +l -$! \n"; open RP3, '|-', "perl bin/retention_by_product_n2f.pl 1>/dev/ +null " or die "can't fork retention_mywebsearch.pl -$! \n"; open RP4, '|-', "perl bin/retention_by_product.pl 1>/dev/null + " or die "can't fork retention_mywebsearch.pl -$! \n"; open RP5, '|-', "perl bin/retention_mywebsearch_part.pl 1>/de +v/null" or die "can't fork retention_mywebsearch.pl -$! \n"; open RP6, '|-', "perl bin/retention_mywebsearch_specific_trac +k.pl 1>/dev/null" or die "can't fork retention_mywebsearch.pl -$! \n" +; }; if ( $@ ) { print LOG $@; print LOG "\n"; close LOG; exit 1; } #skip the header; my $header = <WP>; while (<WP>){ print RP1 $_; print RP2 $_; print RP3 $_; print RP4 $_; print RP5 $_; print RP6 $_; } close WP; close RP1; close RP2; close RP3; close RP4; close RP5; close RP6; close LOG;

In reply to pipes don't work from cron by vman123

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.