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

Example: Within a (Windows) batch file I call rsh -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

  • 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 -lroot /etc/rtcinst/myscript.ksh & – Doron Dec 1 '11 at 14:48
  • and this: rsh -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

see HELP START and the try this

@echo off
start rsh -lroot /etc/rtcinst/myscript.ksh 
echo BAT continues...
  • @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

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 -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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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