#!/bin/bash # $HeadURL$ $LastChangedRevision$ PROGNAME=`basename $0` echo "setting up environment ..." export ROCON_CFG_FILE=$(pwd)/etc/rocon.conf echo "initialising config file ..." mkdir -p ${ROCON_CFG_FILE%/*} > $ROCON_CFG_FILE echo "adding some hosts ..." rocon -A host1 rocon -A host2 rocon -A host3 rocon -A host4 #echo "using rocon to run a normal command (on deliberately invalid hosts) ..." #rocon -c hostname 1 2>&1 | sort echo "writing ssh replacement ..." SSH_CMD=$(pwd)/tmp/myssh mkdir -p ${SSH_CMD%/*} { echo "#!/bin/bash" echo "usage() { echo \"Usage: \${0##*/} \" >&2; exit 1; }" echo "error() { echo \"\${0##*/}: ERROR: \$1\" >&2; exit 1; }" echo "[ \$# = 2 ] || usage" echo "echo \"should do something *local* with hostname \$1\"" } > $SSH_CMD chmod 755 $SSH_CMD echo "calling rocon with ${SSH_CMD##*/} ..." rocon --ssh=$SSH_CMD -c dummy 1 2>&1 | sort echo "setting ROCON_SSH_CMD, dropping '--ssh=...', and repeating ..." export ROCON_SSH_CMD=$SSH_CMD rocon -c dummy 1 2>&1 | sort echo "calling rocon with ${SSH_CMD##*/} with stdin from /dev/null ..." rocon -c dummy 1 2>&1 &1 | sort echo "calling rocon with ${SSH_CMD##*/} with setsid and with stdin from /dev/null ..." setsid rocon -c dummy 1 2>&1 < /dev/null | sort echo "calling rocon with ${SSH_CMD##*/} with stripped environment ..." # Need to preserve PATH so that *this* test script calls the right rocon. The other # two preserved variables tell rocon which config file and which ssh command to use. env -i PATH=$PATH ROCON_CFG_FILE=$ROCON_CFG_FILE ROCON_SSH_CMD=$ROCON_SSH_CMD rocon -c dummy 1 2>&1 | sort echo "all done"