Operating System - HP-UX
1752754 Members
4736 Online
108789 Solutions
New Discussion

Running remsh in background reports Stopped (tty input)

 
SOLVED
Go to solution
Gary Cooper_1
Esteemed Contributor

Running remsh in background reports Stopped (tty input)

I'm sure the gurus among you will know the answer to this immediately.

 

Here's my script...

pw=$(remsh devp53 cat /tmp/myfile)

echo pw=$pw

 

If I run it in foreground, it works OK...

$ test_remsh

pw=Hello World

$

 

If I run it in background it doesn't work...

$ test_remsh &

[3] 5260

$

[3] + Stopped (tty input) test_remsh &

$

 

Any ideas?

 

Many thanks,

 

Gary

1 REPLY 1
Gary Cooper_1
Esteemed Contributor
Solution

Re: Running remsh in background reports Stopped (tty input)

Hmmm... If all else fails read the manual :)

 

Man page for remsh...

 

By default, remsh reads its standard input and sends it to the remote command because remsh has no way to determine whether the remote command requires input. The -n option redirects standard input to remsh from /dev/null. This is useful when running a shell script containing a remsh command, since otherwise remsh may use input not intended for it. The -n option is also useful when running remsh in

the background from a job control shell, /usr/bin/csh or /usr/bin/ksh. Otherwise, remsh stops and waits for input from the terminal keyboard for the remote command. /usr/bin/sh automatically redirects its input from /dev/null when jobs are run in the background.

 

So what I needed was the "-n" option and the script now works .

 

Regards,

 

Gary