Skip to content

Commit

Permalink
WIP WIP WIP WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaste committed May 29, 2023
1 parent a078ca9 commit 23677b3
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions nix/workbench/service/healthcheck.nix
Expand Up @@ -36,7 +36,7 @@ let
# pipefail: Any failed command in a pipeline is used as return code
set -euo pipefail
echo "$(date --rfc-3339=seconds): started"
echo "$(${coreutils}/bin/date --rfc-3339=seconds): started"
# Fetch every node name (Including "explorer" nodes)
nodes=$(${jq}/bin/jq --raw-output "keys | join (\" \")" ../node-specs.json)
Expand All @@ -45,7 +45,7 @@ let
echo "Pools: ''${pools}"
# Set the defaults!
now=$(date +%s)
now=$(${coreutils}/bin/date +%s)
for node in ''${nodes[*]}
do
# Create a healthcheck directory inside every node directory
Expand Down Expand Up @@ -109,7 +109,7 @@ let
node_healthcheck_block "''${node}"
node_healthcheck_txs "''${node}"
else
local now=$(date +%s)
local now=$(${coreutils}/bin/date +%s)
local start_time=$(cat "../''${node}/healthcheck/start_time")
if test $((now - start_time)) -ge 300
then
Expand Down Expand Up @@ -172,7 +172,7 @@ let
function node_healthcheck_forge() {
local node=$1
local start_time
local now=$(date +%s)
local now=$(${coreutils}/bin/date +%s)
local last_forged
last_forged=$(last_block_forged "''${node}" 2>&1)
if test -z "''${last_forged}"
Expand All @@ -195,7 +195,7 @@ let
function node_healthcheck_block() {
local node=$1
local start_time
local now=$(date +%s)
local now=$(${coreutils}/bin/date +%s)
local last_block
last_block=$(last_block_transmitted "''${node}" 2>&1)
if test -z "''${last_block}"
Expand All @@ -204,7 +204,7 @@ let
if test $((now - start_time)) -ge 300
then
# Stderr
echo "$(date --rfc-3339=seconds): ''${node}: More than 5m without a first block sent or received" >&2
echo "$(${coreutils}/bin/date --rfc-3339=seconds): ''${node}: More than 5m without a first block sent or received" >&2
exit 1
fi
else
Expand All @@ -220,7 +220,7 @@ let
function node_healthcheck_txs() {
local node=$1
local start_time
local now=$(date +%s)
local now=$(${coreutils}/bin/date +%s)
local last_txs
last_txs=$(last_block_with_txs "''${node}" 2>&1)
if test -z "''${last_txs}"
Expand Down Expand Up @@ -526,13 +526,13 @@ let
function exit_healthcheck {
# Unbuffered stderr, if not the error message may be lost!
stdbuf -o0 -e0 echo -e "$(date --rfc-3339=seconds): $1" >&2
stdbuf -o0 -e0 echo -e "$(${coreutils}/bin/date --rfc-3339=seconds): $1" >&2
exit 1
}
function exit_22 {
# Unbuffered stderr, if not the error message may be lost!
stdbuf -o0 -e0 echo -e "$(date --rfc-3339=seconds): $1" >&2
stdbuf -o0 -e0 echo -e "$(${coreutils}/bin/date --rfc-3339=seconds): $1" >&2
exit 22
}
Expand Down

0 comments on commit 23677b3

Please sign in to comment.