[cluster] cluster-deploy: check cluster-ping dep.

Make sure cluster-ping is present along with cluster-deploy.
This commit is contained in:
Matteo Cypriani 2014-03-22 12:22:46 -04:00
parent b1acbe2a70
commit b97bf7ed14
1 changed files with 7 additions and 2 deletions

View File

@ -81,12 +81,17 @@ fi
# Check dependencies
PSCP=$(command -v parallel-scp || command -v pscp.pssh || command -v pscp)
PRSYNC=$(command -v parallel-rsync || command -v prsync)
CLUSTERPING=$(command -v cluster-ping)
if [ "$RSYNC" = "" -a "$PSCP" = "" ] ; then
echo "Parallel SSH (pssh) is required for this script to work."
exit 4
elif [ "$PRSYNC" = "" ] ; then
echo "Parallel rsync (prsync) is required for this script to work."
exit 5
elif [ "$CLUSTERPING" = "" ] ; then
echo "cluster-ping (which should have been provided along with this"
echo "script) is required for this script to work."
exit 6
fi
# Hosts' list file
@ -108,10 +113,10 @@ fi
# Test the connection to the first host and get the destination
# directory (home directory of the remote user)
FIRST_HOST=$(cluster-ping "$HOSTS_LIST_NAME" 2>/dev/null | sed -n "s/ is alive$//p" | head -n1)
FIRST_HOST=$($CLUSTERPING "$HOSTS_LIST_NAME" 2>/dev/null | sed -n "s/ is alive$//p" | head -n1)
if [ "$FIRST_HOST" = "" ] ; then
echo "None of the remote hosts is alive."
exit 6
exit 7
fi
echo "Testing connection to $FIRST_HOST..."
DEST_DIR="$(ssh ${SSH_LOGIN}${FIRST_HOST} 'echo $HOME' 2>/dev/null)"