I have a perl script that runs completely fine in the foreground, but will either hang or exit when run in background mode (tcsh shell in UNIX). The script calls three other scripts: Script 1: Syncs directory structures from two partitions Script 2: Syncs files within directories Script 3: Called in a loop and processes one or more files. All three made UNIX system calls via backticks. Originally, scripts 1 & 2 were called and had their output gathered via backtick and script 3 was called with open. I thought that it was the backticks that were causing the problems and I was receiving: suspended (tty output) messages, so I replaced the backtick calls to script 1 and 2 with open calls and it seemed to work. Then another user ran the wrapper script, backgrounded it, logged off, and the processes exited before completion (not sure if it was directly after logging off or not). What can I do to help these scripts run in the background? I have a feeling it has to do with reading input from the scripts with the open calls, but I’m not sure.

In reply to Script hangs or dies when run in background. Works fine in foreground. by mears11

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.