1753973 Members
8148 Online
108811 Solutions
New Discussion юеВ

remsh command won't exit

 
Jeff Patrick
Advisor

remsh command won't exit

Hello. I have 2 different commands that I run within a script, that both use remsh to kick off programs on another server. The exact commands are as follows:

/usr/bin/remsh infpap1 '/usr/bin/su - applprod -c ./start_forms'

and

/usr/bin/remsh infpap1 '/usr/bin/su - oraprod -c ./start_web'

The first one works and exits correctly. The 2nd one runs the target program properly (exit 0), but never remsh command itself never exits, thus the next part of the script doesn't get run. A couple notes: the scripts in each command, 'start_forms' and 'start_web' are identical in format. Also, I've run these from the command line as well, and gotten the same result. The 2nd command will show up with 2 processes still out there on a ps listing, and when I kill -9 these processes, I finally get my prompt back (or, when run from within the script, kill -9 will get the rest of the script to then finish properly). Any ideas? Thanks in advance for any help.

-Jeff
4 REPLIES 4
Jeff Patrick
Advisor

Re: remsh command won't exit

Just one other thing that I wanted to mention...I've used the '-n' flag with remsh, and this hasn't fixed the issue either. Thanks again.

Jeff
Bill Hassell
Honored Contributor

Re: remsh command won't exit

When scripting remsh commands, it is a good idea to use the -n option since your shell is not interactive.


Bill Hassell, sysadmin
Jeff Patrick
Advisor

Re: remsh command won't exit

Bill,

I've used the '-n' flag, but to no avail. It does the exact same thing. Thanks for the help though.
federico_3
Honored Contributor

Re: remsh command won't exit

What causes the problem is that the Standard output and the standard input of the remsh processes are inherited by any process that it forks.So if you for instance start an oracle db THEN THE REMSH WILL HANG UNTIL THAT CHILD process terminates.
Try to redirect standard of remsh and the child process to /dev/null and standard out/err to either a log file or /dev/null .

/usr/bin/remsh infpap1 '/usr/bin/su - oraprod -c ./start_web < /dev/null > /tmp/filelog 2>&1'