#!/bin/bash

#-----------------------------
# This is a working template for a simple script to perform crash
# recovery testing in Persistit.  This script should be run from the
# root directory of the Persistit project. To run this
# part part of the test:
#
# # To run this test:
#
#   ./src/test/resources/stress-recovery-remote2 username@remotehost remote_directory_path
#
# Where remote_directory_path is the full path on the remote machine to the
# root of an akiban-persistit working directory.
#
# This script is the second half of a test start started by
# stress-recovery-remote1. This half checks the validity of the
# recovered database after the remote target machine has been
# manually crashed and restarted.
#-----------------------------


local_datapath=/tmp/persistit_test_data
remote_datapath="~/persistit_test_data"
jvm_options="-Xmx2G -Xrunjdwp:transport=dt_socket,address=8000,suspend=n,server=y"

testrunner_command="cd $2 ; java $jvm_options -cp \`find . -name akiban-persistit\*with-dependencies\*.jar\` "

command="ssh $1 $testrunner_command com.persistit.stress.Recovery2_Stdin datapath=$remote_datapath"
echo "$command  < $local_datapath/recovery.log"
$command  < $local_datapath/recovery.log


