1820879 Members
4142 Online
109628 Solutions
New Discussion юеВ

Running in bg stopped

 
perez Ilan
Occasional Advisor

Running in bg stopped

Hi all,

I wrote a shell script (sh) running in background. In every single cycle of operation the job stopped (Stopped(SIGTTOU)).
in foreground it runs well.
I tried to run it like this.
$daemon >/dev/null 2>&1 &

what could be the reasons for this behavior?
what (SIGTTOU)mean?

Thanks in advance,
Perez Ilan.
11 REPLIES 11
Daimian Woznick
Trusted Contributor

Re: Running in bg stopped

SIGTTOU means that the background process is attempting to write. Refer to the following link for some information on signals:

http://www.ecst.csuchico.edu/~beej/guide/ipc/signals.html
James R. Ferguson
Acclaimed Contributor

Re: Running in bg stopped

Hi:

I suspect that you are trying to read 'stdin' in your script.

Regards!

...JRF...
Steven Mertens
Trusted Contributor

Re: Running in bg stopped

hi,

SIGTTOU means background write to control
terminal.

Did you try to start the shell script with
nohup ?

nohup daemon > /dev/null 2>&1 &

Steven
perez Ilan
Occasional Advisor

Re: Running in bg stopped

Hi again and Thanks,

Steven,I tried the nohup daemon > /dev/null 2>&1 &
now, the same results.

James R. - I'm not sure I understand the meaming "trying to read 'stdin' "

I attached the sort script.

Thanks again.
Ilan.

H.Merijn Brand (procura
Honored Contributor

Re: Running in bg stopped

Reading from a tty (keyboard).

i.e. does 'transport' ask for an ok to continue? If so, do

echo "y" | transport ...
or if no input is to be given, but a bad written 'transport' expects stdio,

transport ...
HTH
Enjoy, Have FUN! H.Merijn
Steven Mertens
Trusted Contributor

Re: Running in bg stopped


You can add a lot of echo's for
debugging the script so you can naildown
the program or command that causes the
problem. Redirect the output from the echo's
to a logfile. Or set -x.

Steven


Steven Mertens
Trusted Contributor

Re: Running in bg stopped


Not giving up :)

What if you try to set the following in
the script

stty -tostop

That's just a guess. I even don't know if
its an option on hpux on the gnu version it
exist.

If the problem is the transport program I
think the program needs to be adjusted so
it ignores the SIGTTOU signal.

see also :
http://docsrv.caldera.com/cgi-bin/man/man?termio+7

Steven



perez Ilan
Occasional Advisor

Re: Running in bg stopped

Dear friends,

Thank for all your answers, I could not find the problem, but I found that the command:
$su - bzdadm -c "mv ...." is the cause.
so I change the script the way it could work with out the "su - ..." command.
not too elegant solution but working.

Thanks again.
Perez Ilan.
Pete Randall
Outstanding Contributor

Re: Running in bg stopped

Wouldn't the su command be waiting for a password? i.e. waiting for stdin?

Pete

Pete
perez Ilan
Occasional Advisor

Re: Running in bg stopped

Hi Pete Randall,

No, this script runs from root.

Regards,
Ilan.
Pete Randall
Outstanding Contributor

Re: Running in bg stopped

Hi Perez,

The $ prompt threw me off. At least you've got it working.

Pete

Pete