# This file contains a list of named command-line commands that are executed
# after substituting the appropriate dynamic values.
#
# Valid variables are:
# 
#     hostName               External host name of remote host
#     hostUserId             User ID for remote host
#     sshPrivateKey          Local path to SSH private key to use to connect
#     destinationDirectory   Relative directory on remote host under which 
#                            the files will be copied
#     voldemortRootDirectory Relative directory on remote host which points 
#                            to the Voldemort distribution; usually it's
#                            ${destinationDirectory}/voldemort
#     voldemortHomeDirectory Relative directory on remote host which points 
#                            to the Voldemort configuration; usually it's
#                            ${voldemortRootDirectory}/config/<some directory>
#     voldemortNodeId        Node ID (as seen in cluster.xml) of the node
#     remoteTestArguments    Arguments passed to the voldemort-remote-test.sh
#                            command on the remote host
#     sourceDirectory        Local path which points to the Voldemort 
#                            distribution; this is copied to
#                            ${voldemortParentDirectory}
#
# Of course, feel free to update CommandLineClusterOperation.java and
# CommandLineClusterConfig.java to add more variables, as needed.

RsyncDeployer.rsync=rsync -vazc --delete --progress --exclude=.git --exclude=src/java/voldemort --exclude=test --exclude=contrib --exclude=example --exclude=docs \
                    -e "ssh -o StrictHostKeyChecking=no -i ${sshPrivateKey}" \
                    ${sourceDirectory} ${hostUserId}@${hostName}:${destinationDirectory}

RsyncDeployer.rsync.nokey=rsync -vazc --delete --progress --exclude=.git --exclude=src/java/voldemort --exclude=test --exclude=contrib --exclude=example --exclude=docs \
                          -e "ssh -o StrictHostKeyChecking=no" \
                          ${sourceDirectory} ${hostUserId}@${hostName}:${destinationDirectory}

SshClusterCleaner.ssh=ssh -o StrictHostKeyChecking=no -i ${sshPrivateKey} ${hostUserId}@${hostName} \
                     "rm -rf ${voldemortHomeDirectory}/data "
								  
SshClusterCleaner.ssh.nokey=ssh -o StrictHostKeyChecking=no ${hostUserId}@${hostName} \
                           "rm -rf ${voldemortHomeDirectory}/data "
								  
SshClusterStarter.ssh=ssh -o StrictHostKeyChecking=no -i ${sshPrivateKey} ${hostUserId}@${hostName} \
                     "export VOLDEMORT_HOME=$(pwd)/${voldemortHomeDirectory} ; \
                      export VOLDEMORT_NODE_ID=${voldemortNodeId} ; \
                      mv $VOLDEMORT_HOME/config/server.properties $VOLDEMORT_HOME/config/server.properties.bak ; \
                      grep -v "^node.id=" $VOLDEMORT_HOME/config/server.properties.bak > $VOLDEMORT_HOME/config/server.properties ; \
                      rm -rf ${voldemortHomeDirectory}/data ; \
                      rm -rf ${voldemortHomeDirectory}/config/.temp ; \
                      rm -rf ${voldemortHomeDirectory}/config/.version ; \
                      cd ${voldemortRootDirectory} ; \
                      ./bin/voldemort-server.sh"
								  
SshClusterStarter.ssh.nokey=ssh -o StrictHostKeyChecking=no ${hostUserId}@${hostName} \
	                       "export VOLDEMORT_HOME=$(pwd)/${voldemortHomeDirectory} ; \
	                        export VOLDEMORT_NODE_ID=${voldemortNodeId} ; \
	                        mv $VOLDEMORT_HOME/config/server.properties $VOLDEMORT_HOME/config/server.properties.bak ; \
	                        grep -v "^node.id=" $VOLDEMORT_HOME/config/server.properties.bak > $VOLDEMORT_HOME/config/server.properties ; \
	                        rm -rf ${voldemortHomeDirectory}/data ; \
	                        rm -rf ${voldemortHomeDirectory}/config/.temp ; \
                       		rm -rf ${voldemortHomeDirectory}/config/.version ; \
	                        cd ${voldemortRootDirectory} ; \
	                        ./bin/voldemort-server.sh"
								  
SshClusterStopper.ssh=ssh -o StrictHostKeyChecking=no -i ${sshPrivateKey} ${hostUserId}@${hostName} \
                     "cd ${voldemortRootDirectory} ; ./bin/voldemort-stop.sh"

SshClusterStopper.ssh.nokey=ssh -o StrictHostKeyChecking=no ${hostUserId}@${hostName} \
                           "cd ${voldemortRootDirectory} ; ./bin/voldemort-stop.sh"

SshRemoteTest.ssh=ssh -o StrictHostKeyChecking=no -i ${sshPrivateKey} ${hostUserId}@${hostName} "${testCommand}"

SshRemoteTest.ssh.nokey=ssh -o StrictHostKeyChecking=no ${hostUserId}@${hostName} "${testCommand}"
