Read etcshadow's reply again. And try his suggestion. If it works, then the child's pid is irrelevant; you have a buffering problem. When running under cron, you'll be sending the output to a pipe, which may buffer more than sending it to a tty.

If setting $|=1 fixes the problem but you don't want to disable buffering, use { local $| = 1 } (including the curlies) to force a flush at the appropriate point -- probably just before the fork. ($|=1;$|=0 would do the same thing but wouldn't restore the buffering status, which is an unfriendly thing to do, especially if you're mixing in anyone else's code.)


In reply to Re: Re: Re: main script invoked twice by sfink
in thread main script invoked twice by steves

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.