From a6fd1ca3dbbd83ac54c276db3a0a26421b147009 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Sun, 23 Dec 2018 08:54:24 -0800 Subject: [PATCH] Add logs subcommand to fetch remote logs from each network node --- net/net.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/net/net.sh b/net/net.sh index 48e3f7cc0a..607f68fafa 100755 --- a/net/net.sh +++ b/net/net.sh @@ -23,6 +23,7 @@ Operate a configured testnet stop - Stop the network restart - Shortcut for stop then start update - Live update all network nodes + logs - Fetch remote logs from each network node start/update-specific options: -S [snapFilename] - Deploy the specified Snap file @@ -47,6 +48,9 @@ Operate a configured testnet stop-specific options: none + logs-specific options: + none + EOF exit $exitcode } @@ -472,6 +476,26 @@ sanity) stop) stop ;; +logs) + fetchRemoteLog() { + declare ipAddress=$1 + declare log=$2 + echo "--- fetching $log from $ipAddress" + ( + set -x + timeout 30s scp "${sshOptions[@]}" \ + "$ipAddress":solana/"$log".log log/remote-"$log"-"$ipAddress".log + ) || echo "failed to fetch log" + } + fetchRemoteLog "${fullnodeIpList[0]}" drone + for ipAddress in "${fullnodeIpList[@]}"; do + fetchRemoteLog "$ipAddress" fullnode + done + for ipAddress in "${clientIpList[@]}"; do + fetchRemoteLog "$ipAddress" client + done + ;; + *) echo "Internal error: Unknown command: $command" exit 1