[comp.lang.perl] Backgrounding a perl program

G.Eustace@massey.ac.nz (Glen Eustace) (06/25/91)

Firstly I'll admit to being a complete novice at perl programming.
But I will add that I am impressed by what one can do with it.  My
first attempts do what I want, almost.

I have a couple of perl programs that analyse the repquota reports
from a number of systems and then produce summarised data.

If I type the command

mu_quotasummary | more

I get exactly what I wanted.

mu_quotasummary > results &

sits in a Stopped state, awaiting tty input.

I don't read from STDIN or /dev/tty at all.  Is there some trick to
getting the program to run in the background.  I had wanted to put it
in to crontab to run every week but my first attempts have meet with
little success.

I am using perl 3.0p37 on a Pyramid but I don't think my difficulty
is version specific.

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Glen Eustace, Systems Software Manager | EMail: G.Eustace@massey.ac.nz
 Computer Centre,  Massey University,  Palmerston North,  New Zealand
Phone: +64 6 356 9099 x7440, Fax: +64 6 350 5607,     Timezone: GMT-12

frazier@oahu.cs.ucla.edu (Greg Frazier) (06/25/91)

G.Eustace@massey.ac.nz (Glen Eustace) writes:

>If I type the command

>	mu_quotasummary | more

>I get exactly what I wanted.

>	mu_quotasummary > results &

>sits in a Stopped state, awaiting tty input.
>I don't read from STDIN or /dev/tty at all.  Is there some trick to
>getting the program to run in the background.  I had wanted to put it
>in to crontab to run every week but my first attempts have meet with
>little success.

Do you have "rsh" commands in your program? I.e.

	system ("rsh thatmachine doquota");

If you do, it is the "rsh" that wants the tty input.  Change the
command to

	system ("rsh thatmachine -n doquota");

This redirects stdin to be from /dev/null on the remote
machine, rather than from your keyboard.  Yes, I realize
that "doquota", or whatever your command is, does not use
the keyboard, but "rsh" still tries to grab stdin before
calling "doquota".

If you don't have "rsh" in your code, then please ignore all
of that babble.
-- 


Greg Frazier	frazier@CS.UCLA.EDU	!{ucbvax,rutgers}!ucla-cs!frazier

G.Eustace@massey.ac.nz (Glen Eustace) (06/26/91)

>>If I type the command
>
>>	mu_quotasummary | more
>
>>I get exactly what I wanted.
>
>>	mu_quotasummary > results &
>
>>sits in a Stopped state, awaiting tty input.
>>I don't read from STDIN or /dev/tty at all.  Is there some trick to
>>getting the program to run in the background.  I had wanted to put it
>>in to crontab to run every week but my first attempts have meet with
>>little success.
>
>Do you have "rsh" commands in your program? I.e.
>
>	system ("rsh thatmachine doquota");
>
>If you do, it is the "rsh" that wants the tty input.  Change the
>command to
>
>	system ("rsh thatmachine -n doquota");
>

This is exactly what I was doing in the perl program.  It seems that
there is always something lurking to byte the unwary.  My appologies
for assuming the problem was perl when in fact rsh is the culprit.

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Glen Eustace, Systems Software Manager | EMail: G.Eustace@massey.ac.nz
 Computer Centre,  Massey University,  Palmerston North,  New Zealand
Phone: +64 6 356 9099 x7440, Fax: +64 6 350 5607,     Timezone: GMT-12