#!/bin/bash set -eo pipefail function cleanup() { for pid in `/bin/ps -fu $USER| grep "benchmark\|txgen\|soldier\|commander\|profiler\|beacon" | grep -v "grep" | grep -v "vi" | awk '{print $2}'`; do echo 'Killed process: '$pid kill -9 $pid 2> /dev/null done } trap cleanup SIGINT SIGTERM function usage { local ME=$(basename $0) cat< $log_folder/beacon.log 2>&1 & sleep 1 #wait or beachchain up fi # Start nodes while IFS='' read -r line || [[ -n "$line" ]]; do IFS=' ' read ip port mode shardID <<< $line #echo $ip $port $mode if [ "$mode" != "client" ]; then if [ -z "$PEER" ]; then ./bin/benchmark -ip $ip -port $port -config_file $config -log_folder $log_folder $DB -min_peers $MIN & else ./bin/benchmark -ip $ip -port $port -log_folder $log_folder $DB $PEER -min_peers $MIN & sleep 1 fi fi done < $config echo "launching txgen ..." if [ "$TXGEN" == "true" ]; then if [ -z "$PEER" ]; then ./bin/txgen -config_file $config -log_folder $log_folder -duration $DURATION else ./bin/txgen -log_folder $log_folder -duration $DURATION $PEER fi fi cleanup