Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

SIGTTIN when running with &

by Massyn (Hermit)
on Nov 11, 2002 at 09:43 UTC ( #211879=perlquestion: print w/replies, xml ) Need Help??
Massyn has asked for the wisdom of the Perl Monks concerning the following question:


I've coded a perl script to report the status of our Tivoli environment. Everything works fine when I run the script, however, when I put the script in the background with the & operator, the script terminates with the following error.

1 + Stopped (SIGTTIN) nohup ./ &

I could isolate the problem down to this line of code, which executes an rsh to a remote AIX server. rsh works fine, as said before, I can execute the script without a problem.

$tmp = `rsh aixhost2 df -k | awk {'print \$4,\$7'} | grep -v \"Mounted +\"`;



You never know how important a backup is until you need it.

Replies are listed 'Best First'.
Re: SIGTTIN when running with &
by amphiplex (Monk) on Nov 11, 2002 at 10:06 UTC
    Hi !

    Maybe you should run rsh with the -n option ?
    This option redirects input from /dev/null, it fixed the problem for me.

    ---- amphiplex
Re: SIGTTIN when running with &
by joe++ (Friar) on Nov 11, 2002 at 10:12 UTC
    Hmm... something with connectivity to a terminal?
    man signal(7) says:
    Signal Value Action Comment -------------------------------------- SIGTTIN 21,21,26 D tty input for background process ... D Default action is to stop the process.
    (Note: manual page from Debian Linux on i386 arch.).

    Cheers, Joe

Re: SIGTTIN when running with &
by MZSanford (Curate) on Nov 11, 2002 at 13:56 UTC

    Any time you run an external program, you run this risk. If the program you are running tries to open the tty to which it is connected, this will happen. I have seen this a great many times with batch perl processes.

    I guess you have a few options. With rsh, i believe someone mentioned the -n option, which fixes this. With some other programs (and even some XS modules) where a similar option is not avaialble, i have found i normally have to open a second terminal, start the program with a nohup, and close that terminal... or run programs using cron or at.

    from the frivolous to the serious

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://211879]
Approved by BrowserUk
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2018-06-24 17:42 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.