Operating System - HP-UX
1848284 Members
5824 Online
104024 Solutions
New Discussion

remsh not backgrounding with nohup and "&" on 11.0

 
SOLVED
Go to solution
jerry1
Super Advisor

remsh not backgrounding with nohup and "&" on 11.0

I have noticed that doing a remsh to HP-UX 11.0
when trying to spwan off a background process that won't die when you exit. example:

exec nohup &

That the script waits till the process is done.

This is only when trying to remsh to an HP-UX
11.0 OS. HP-UX 11i does not have this problem.
The process is backgrounded and the remsh exits.

Here is a simple example:

Script A:

#!/bin/ksh
# scripta
remsh $1 ./scriptb


Script B:

#!/bin/ksh
#scriptb
exec nohup sleep 10 &


Run script A to hp-ux 11.0 and 11i system:

scripta

scripta

Can someone tell me why this behavior is different between 11.0 and 11i?

I need to be able to remsh into serveral
systems and run a continual process in the backgrond.



4 REPLIES 4
Scot Bean
Honored Contributor
Solution

Re: remsh not backgrounding with nohup and "&" on 11.0

"man remsh" recommends the following synyax to run a remote cmd that does not wait for the return:

remsh otherhost -n "command 1>&- 2>&- &"
Sridhar Bhaskarla
Honored Contributor

Re: remsh not backgrounding with nohup and "&" on 11.0

Hi Jerry,

Scott got it. Use '-n' option with the command as it redirects input from /dev/null instead of the shell to wait for input from the keyboard.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Dietmar Konermann
Honored Contributor

Re: remsh not backgrounding with nohup and "&" on 11.0

The described behaviour has been changed several times with patches... on both, 11.00 and 11.11, afaik.

The current behaviour (recent r-commands patches installed) is:

- wait (default)
- don't wait (if remshd is called wirth new -m option)

So I suggest to simply install recent patches and then use -m to get the desired behaviour.

11.00: PHNE_23003
11.11: PHNE_30433

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Muthukumar_5
Honored Contributor

Re: remsh not backgrounding with nohup and "&" on 11.0

It will be expecting users input to stop the exec nohup sleep 10& on remote node.

You can try as,

remsh -n "command 1 1>/tmp/remotelog.log1 2>&1 &; command 2 1>/tmp/remotelog.log2 2>&1 &"

Or change the code of script B as,
#!/bin/ksh
#scriptb
exec nohup sleep 10 1>/tmp/log 2>&1 &

Else simply,

#!/bin/ksh
#scriptb
exec nohup sleep 10 1>&- 2>&- &

so that it will not expect user input to upon completion of sleep 10 execution.

HTH.
Easy to suggest when don't know about the problem!