Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to issue an rsh command to run in the background?

Example: Within a (Windows) batch file I call rsh 10.1.1.2 -lroot /etc/rtcinst/myscript.ksh, which runs on a remote unix machine. This script takes a while to execute, and I want my batch file to continue running parallel to this ksh script.

The idea is, that the batch file that executes this command will continue running and not block until the script returns/exits.

Thanks. Hirschkäfer

share|improve this question
    
add an & to the end of the command to run it in the background. Read more at tdlp –  Fredrik Pihl Dec 1 '11 at 14:37
    
I did try it, but it does not work –  Doron Dec 1 '11 at 14:48
    
tried this: rsh 10.1.1.2 -lroot /etc/rtcinst/myscript.ksh & –  Doron Dec 1 '11 at 14:48
    
and this: rsh 10.1.1.2 -lroot "/etc/rtcinst/myscript.ksh &" –  Doron Dec 1 '11 at 14:49
    
'batch file' is usually associated with the Windows environment, but your script name says ksh. Are you using Linux or Windows with Cygwin or ?? Good luck. –  shellter Dec 1 '11 at 15:33
show 1 more comment

migrated from stackoverflow.com Dec 2 '11 at 14:38

This question came from our site for professional and enthusiast programmers.

2 Answers

see HELP START and the try this

@echo off
start rsh 10.1.1.2 -lroot /etc/rtcinst/myscript.ksh 
echo BAT continues...
share|improve this answer
    
@Keith. OP clearly says in her last comment that she invokes rsh in a windows BAT which in turn invokes the ksh script remotely. –  PA. Dec 1 '11 at 17:14
    
I missed that. I'll delete my first comment. –  Keith Thompson Dec 1 '11 at 18:00
add comment

The rsh command should run in the background when used with the '&' at the end of the command. The problem can be that the program is stopped on a signal waiting for input, so adding a

rsh 10.1.1.2 -lroot /etc/rtcinst/myscript.ksh </dev/null &

Generally works around this issue. Rsh also takes a '-n' option that performs the same task as redirecting from /dev/null

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.