http://qs1969.pair.com?node_id=92625

deprecated has asked for the wisdom of the Perl Monks concerning the following question:

Hiya, Monks!

I have a bunch of perl scripts that have runtimes that extend past 24 hours. Mostly I am reading tape drives and passing hundreds of gigs through thumbnailing and conversion utilities. Usually I just run these out of my terminal window. However, my laptop is prone to crashing while our servers (ultra 10s) are not. So I run them nohup and watch the output.

There is no TTY input requested (<> for example), but some of my jobs are dying with SIGTTIN. The ever helpful manpage for signal(5) has this to say:

SIGTTIN 26 Stop Stopped (tty input) (see termio(7I))
Now, my feeling here is that the machine thinks my program is asking for input and there is no controlling tty so it is dying.

If his highness tilly doesn't mind, i'd like to have a discussion about signals in perl. And japhy has something to contribute here too because of a discussion we had on fun with perl a few months ago.

$SIG{TTIN} = \&amp;amp;next;
This seems strange. Youre executing next outside of a loop? Well, as I understand it, you can use last to get out of a loop like this:
$SIG{INT} = sub { last };
and in fact, Randal recommended this and said he uses it frequently on a program that may be having a problem in a loop so he can ^C out of the loop -- but not the program. People scorned the "solution", but I think it has a certain elegance to it.

This is all fine and good, but even the perl documentation (I forget which doc at the moment) mentions that Solaris is among the unixen with hopelessly b0rked signals. And, I've been bitten by this before.

So what I'd like to do is catch this SIGTTIN and skip whatever my code is doing that is pissing solaris off.

Comments? Ideas?

brother dep.

--
Laziness, Impatience, Hubris, and Generosity.