Skip to content

Commit

Permalink
Print output of cluster bash script to both terminal and file (#1282)
Browse files Browse the repository at this point in the history
* Change cluster script to print output to files

* Optional print to the logs
  • Loading branch information
Stefan-Ethernal authored Mar 15, 2023
1 parent f8a9738 commit f00c788
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions scripts/cluster
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,36 @@ function createGenesis() {
}

function startServerFromBinary() {
./polygon-edge server --data-dir ./test-chain-1 --chain genesis.json --grpc-address :10000 --libp2p :30301 --jsonrpc :10002 --num-block-confirmations 2 --seal --log-level DEBUG &
./polygon-edge server --data-dir ./test-chain-2 --chain genesis.json --grpc-address :20000 --libp2p :30302 --jsonrpc :20002 --num-block-confirmations 2 --seal --log-level DEBUG &
./polygon-edge server --data-dir ./test-chain-3 --chain genesis.json --grpc-address :30000 --libp2p :30303 --jsonrpc :30002 --num-block-confirmations 2 --seal --log-level DEBUG &
./polygon-edge server --data-dir ./test-chain-4 --chain genesis.json --grpc-address :40000 --libp2p :30304 --jsonrpc :40002 --num-block-confirmations 2 --seal --log-level DEBUG &
wait
if [ "$1" == "write-logs" ]; then
echo "Writing validators logs to the files..."
./polygon-edge server --data-dir ./test-chain-1 --chain genesis.json \
--grpc-address :10000 --libp2p :30301 --jsonrpc :10002 \
--num-block-confirmations 2 --seal --log-level DEBUG 2>&1 | tee ./validator-1.log &
./polygon-edge server --data-dir ./test-chain-2 --chain genesis.json \
--grpc-address :20000 --libp2p :30302 --jsonrpc :20002 \
--num-block-confirmations 2 --seal --log-level DEBUG 2>&1 | tee ./validator-2.log &
./polygon-edge server --data-dir ./test-chain-3 --chain genesis.json \
--grpc-address :30000 --libp2p :30303 --jsonrpc :30002 \
--num-block-confirmations 2 --seal --log-level DEBUG 2>&1 | tee ./validator-3.log &
./polygon-edge server --data-dir ./test-chain-4 --chain genesis.json \
--grpc-address :40000 --libp2p :30304 --jsonrpc :40002 \
--num-block-confirmations 2 --seal --log-level DEBUG 2>&1 | tee ./validator-4.log &
wait
else
./polygon-edge server --data-dir ./test-chain-1 --chain genesis.json \
--grpc-address :10000 --libp2p :30301 --jsonrpc :10002 \
--num-block-confirmations 2 --seal --log-level DEBUG &
./polygon-edge server --data-dir ./test-chain-2 --chain genesis.json \
--grpc-address :20000 --libp2p :30302 --jsonrpc :20002 \
--num-block-confirmations 2 --seal --log-level DEBUG &
./polygon-edge server --data-dir ./test-chain-3 --chain genesis.json \
--grpc-address :30000 --libp2p :30303 --jsonrpc :30002 \
--num-block-confirmations 2 --seal --log-level DEBUG &
./polygon-edge server --data-dir ./test-chain-4 --chain genesis.json \
--grpc-address :40000 --libp2p :30304 --jsonrpc :40002 \
--num-block-confirmations 2 --seal --log-level DEBUG &
wait
fi
}

function startServerFromDockerCompose() {
Expand Down Expand Up @@ -95,14 +120,14 @@ case "$2" in
initIbftConsensus
# Create genesis file and start the server from binary
createGenesis
startServerFromBinary
startServerFromBinary $2
exit 0;
elif [ "$1" == "polybft" ]; then
# Initialize polybft consensus
initPolybftConsensus
# Create genesis file and start the server from binary
createGenesis
startServerFromBinary
startServerFromBinary $2
exit 0;
else
echo "Unsupported consensus mode. Supported modes are: ibft and polybft "
Expand Down

0 comments on commit f00c788

Please sign in to comment.