Running commands in parallel (Linux, UNIX)

By default, the command is run sequentially at each computer, but you can specify to run the commands in parallel using background rshells by prefixing the command with certain prefix sequences. If the rshell is run in the background, then each command puts the output in a buffer file at its remote computer.

Note: The information in this section applies to Linux® and UNIX operating systems only.
This process retrieves the output in two pieces:
  1. After the remote command completes.
  2. After the rshell terminates, which might be later if some processes are still running.

The name of the buffer file is /tmp/$USER/rahout by default, but it can be specified by the environment variables $RAHBUFDIR or $RAHBUFNAME.

When you specify that you want the commands to be run concurrently, by default, this script prefixes an additional command to the command sent to all hosts to check that $RAHBUFDIR and $RAHBUFNAME are usable for the buffer file. It creates $RAHBUFDIR. To suppress this, export an environment variable RAHCHECKBUF=no. You can do this to save time if you know that the directory exists and is usable.

Before using rah to run a command concurrently at multiple computers:
  • Ensure that a directory /tmp/$USER exists for your user ID at each computer. To create a directory if one does not exist, run:
      rah ")mkdir /tmp/$USER"
  • Add the following line to your .kshrc (for Korn shell syntax) or .profile, and also type it into your current session:
      export RAHCHECKBUF=no
  • Ensure that each computer ID at which you run the remote command has an entry in its .rhosts file for the ID which runs rah; and the ID which runs rah has an entry in its .rhosts file for each computer ID at which you run the remote command.