Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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:

#!/fellow/monks.pl

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 ./sm-status.sh &

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 +\"`;

Thanks!

#!/massyn.pl

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

Comment on SIGTTIN when running with &
Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://211879]
Approved by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2014-08-20 20:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (124 votes), past polls