From a295faec52eb9196f5191761826e8fb3faa8afa3 Mon Sep 17 00:00:00 2001 From: teor Date: Tue, 17 Jan 2023 17:58:31 +1000 Subject: [PATCH] Log the date and time to make it easier to match errors to node logs --- zebra-utils/zcash-rpc-block-template-to-proposal | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/zebra-utils/zcash-rpc-block-template-to-proposal b/zebra-utils/zcash-rpc-block-template-to-proposal index 483f0fe7770..2c5e8a08b39 100755 --- a/zebra-utils/zcash-rpc-block-template-to-proposal +++ b/zebra-utils/zcash-rpc-block-template-to-proposal @@ -16,11 +16,16 @@ function usage() echo "$0 block-template-rpc-port proposal-rpc-port [extra-proposal-rpc-port...] -- [extra-block-template-rpc-json-fields] [extra-proposal-rpc-fields]" } -# Override the commands and settings used by this script using these environmental variables: +# Override the commands used by this script using these environmental variables: ZCASH_CLI="${ZCASH_CLI:-zcash-cli}" -TIME="time" DIFF="${DIFF:-diff --unified --color=always}" BLOCK_TEMPLATE_TO_PROPOSAL="${BLOCK_TEMPLATE_TO_PROPOSAL:-block-template-to-proposal}" +# time how long a command takes to run +TIME="time" +# display the current date and time +DATE="date --rfc-3339=seconds" + +# Override the settings for this script using these environmental variables: TIME_SOURCES="${TIME_SOURCES:-CurTime MinTime MaxTime ClampedNow}" # Process arguments @@ -62,6 +67,8 @@ if [ $# -ge 1 ]; then exit 1 fi +$DATE + # Use an easily identified temp directory name, # but fall back to the default temp name if `mktemp` does not understand `--suffix`. ZCASH_RPC_TMP_DIR=$(mktemp --suffix=.block-template-proposal -d 2>/dev/null || mktemp -d) @@ -139,6 +146,7 @@ echo "getblocktemplate $TEMPLATE_ARG_FULL" echo echo "Querying $TEMPLATE_NODE $TEMPLATE_NET chain at height >=$TEMPLATE_HEIGHT..." +$DATE $TIME $ZCASH_CLI -rpcport="$TEMPLATE_RPC_PORT" getblocktemplate "$TEMPLATE_ARG_FULL" > "$TEMPLATE_NODE_TEMPLATE_RESPONSE" echo "Block template data is in $TEMPLATE_NODE_TEMPLATE_RESPONSE" @@ -173,6 +181,7 @@ echo echo "getblocktemplate proposal submissions:" echo "getblocktemplate $PROPOSAL_ARG_NO_DATA" +$DATE echo PROPOSAL_NODES_PROPOSAL_RESPONSE_BASE="$ZCASH_RPC_TMP_DIR/proposal-check-getblocktemplate-proposal" @@ -213,4 +222,6 @@ for RESPONSE in $PROPOSAL_NODES_PROPOSAL_RESPONSE_LIST; do fi done +$DATE + exit $EXIT_STATUS