#!/bin/sh # Find the real ssh REALSSH=`which -a ssh | grep -v "^$0$" | sed 1q` # Bail out if we're invoking ssh from pssh. For some reason it hangs # if we try to crete amaster connection. if [ xxx$PSSH_NODENUM != "xxx" ] ; then exec $REALSSH "$@" fi # Check for a master $REALSSH -O check "$@" 2>&1 | grep "Master running" >/dev/null # Start a new one in the background if necessary if [ $? -ne "0" ] ; then $REALSSH -MfN "$@" fi # Now we have a master. Execute the original request using the real # ssh. exec $REALSSH "$@"