Operating System - HP-UX
1829992 Members
3053 Online
109998 Solutions
New Discussion

remsh - process wont finish

 
TMcB
Super Advisor

remsh - process wont finish

Hi everyone

I'm having a bit of trouble using remsh.
I need this program to start under another user, so in the crontab I have :
remsh server -l user –n . .profile 2>&1 \; "/usr/epic/lbin/startRF.sh 2>&1"

When I run the above remsh command - it starts the program OK, but the remsh process doesnt end.

Any ideas what Ive done wrong?
Thanks
10 REPLIES 10
IT_2007
Honored Contributor

Re: remsh - process wont finish

what is script is doing? may be sitting in endless loop? check startRF.sh script. if you want run that script use "nohup" command at the beginning of the script like:

nohup /usr/epic/lbin/startRF.sh 2>&1
Hemmetter
Esteemed Contributor

Re: remsh - process wont finish

Hi,

You need to close stdout and stderr if not attached to a terminal like you do for stdin with -n parameter.

according to man remsh(1)

use 2>&- to close stderr and 1>&- to close stdout.


rgds
HGH

TMcB
Super Advisor

Re: remsh - process wont finish

Hi

The script runs OK under its normal user, it's only when I try to run it in 'remsh' that doesnt finish.

Thanks
Yang Qin_1
Honored Contributor

Re: remsh - process wont finish

Hi, if you run only remsh server -l user -n . .profile it works or not? if it works can you try: remsh server -l user -n . .profile 2>&1 ; /usr/epic/lbin/startRF.sh 2>&1
TMcB
Super Advisor

Re: remsh - process wont finish

remsh server -l user -n . .profile
- this part works OK on its own.

Why I try to join the 2 commands, it doesnt work
Yang Qin_1
Honored Contributor

Re: remsh - process wont finish

so, even you removed quote "" it still doesn't work? can you run remsh server -l user /usr/epic/lbin/startRF.sh if you need to execute user's profile, you can add it to startRF.sh for test.
IT_2007
Honored Contributor

Re: remsh - process wont finish

remsh server -l user -n . .profile
- this part works OK on its own.

Why I try to join the 2 commands, it doesnt work
==================

use this way:

remsh server -l user " sh -c \" . .profile 2>&1;/usr/epic/lbin/startRF.sh 2>&1""

IT_2007
Honored Contributor

Re: remsh - process wont finish

sorry forgot -n option.

correct one:

remsh server -l user -n " sh -c \" . .profile 2>&1;/usr/epic/lbin/startRF.sh 2>&1""
TMcB
Super Advisor

Re: remsh - process wont finish

remsh shset001 -l epic-n " sh -c \" . .profile 2>&1;/usr/epic/lbin/startRFservers.sh 2>&1""

- this gives a syntax error.
I'm going to forget about it for today and head home
Bill Hassell
Honored Contributor

Re: remsh - process wont finish

Your .profile is very likely the problem. Most sysadmins do not fix the interactive commands in .profile that require protection with batch environments like remsh (and cron, etc). You must protect all terminal-specific commands such as tabs tput tset ttytype stty, etc by testing for tty -s like this:

if tty -s
then
tabs
fi



Bill Hassell, sysadmin