This is an automated email from the ASF dual-hosted git repository.

ifesdjeen pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-harry.git

commit 26bb6696ba1b18ff5c062d780a9360e750691052
Author: Amos Kong <[email protected]>
AuthorDate: Tue Jun 1 21:50:48 2021 +0800

    script: add options to cassandra-harry script
    
    This patch added options to wrap script, it supported to assign test
    duraton from cmdline.
    
    Signed-off-by: Amos Kong <[email protected]>
---
 scripts/cassandra-harry | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 scylla-usage.md         |  2 +-
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/scripts/cassandra-harry b/scripts/cassandra-harry
index dd27f7b..94ee991 100755
--- a/scripts/cassandra-harry
+++ b/scripts/cassandra-harry
@@ -4,6 +4,54 @@ if [ "x$HARRY_HOME" == 'x' ]; then
     HARRY_HOME=~/cassandra-harry
 fi
 
+print_usage() {
+    cat <<EOF
+Usage: cassandra-harry [options]
+
+Options:
+  -node      ip address  node's ip
+  -run-time  number      run time, unit: hours
+  -run-time-unit unit    unit of run time, HOURS, MINUTES
+  -help                  this helpful message
+EOF
+    exit 1
+}
+
+while [ $# -gt 0 ]; do
+    case "$1" in
+        "-node")
+            node="$2"
+            shift 2
+            ;;
+        "-run-time")
+            run_time="$2"
+            shift 2
+            ;;
+        "-run-time-unit")
+            run_time_unit="$2"
+            shift 2
+            ;;
+        "-help")
+            shift 1
+           print_usage
+            ;;
+        *)
+           print_usage
+            ;;
+    esac
+done
+
+
+if [[ ! -z $node ]]; then
+    sed -i -e "s/contact_points:.*/contact_points: $node/g" 
$HARRY_HOME/conf/external.yaml
+fi
+if [[ ! -z $run_time ]]; then
+    sed -i -e "s/run_time:.*/run_time: $run_time/g" 
$HARRY_HOME/conf/external.yaml
+fi
+if [[ ! -z $run_time_unit ]]; then
+    sed -i -e "s/run_time_unit:.*/run_time_unit: \"$run_time_unit\"/g" 
$HARRY_HOME/conf/external.yaml
+fi
+
 java -Dlogback.configurationFile=$HARRY_HOME/test/conf/logback-dtest.xml \
      -jar 
$HARRY_HOME/harry-integration-external/target/harry-integration-external-0.0.1-SNAPSHOT.jar
 \
      $HARRY_HOME/conf/external.yaml
diff --git a/scylla-usage.md b/scylla-usage.md
index b70f261..159c5c5 100644
--- a/scylla-usage.md
+++ b/scylla-usage.md
@@ -11,5 +11,5 @@ sudo ln -s `realpath scripts/cassandra-harry` 
/usr/bin/cassandra-harry
 ### Execute
 
 ```
-HARRY_HOME=~/cassandra-harry cassandra-harry
+HARRY_HOME=~/cassandra-harry cassandra-harry -run-time 2 -run-time-unit HOURS
 ```

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to