txoo: healthcheck fix latest file retrieval

ls -r1t doesn't get latest time sorted file
r with t reverses things to get oldest one instead
use just r as time of file generation might not be sequential
Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
This commit is contained in:
Lakshya Singh 2024-01-30 22:15:34 +05:30
parent 2b597bb3c6
commit c88dd5fd27
No known key found for this signature in database
GPG Key ID: D3239BA6109A2CE7

View File

@ -4,7 +4,7 @@ set -ex
# Get the latest file with extension .sa from /root/.txoo/$BITCOIN_NETWORK/public directory and get the block number from the file name # Get the latest file with extension .sa from /root/.txoo/$BITCOIN_NETWORK/public directory and get the block number from the file name
TXOO_LOCATION=/root/.txoo/$BITCOIN_NETWORK/public TXOO_LOCATION=/root/.txoo/$BITCOIN_NETWORK/public
latest_block=$(ls -r1t $TXOO_LOCATION | grep '.sa' | head -n1 | cut -d'-' -f1) latest_block=$(ls -r1 $TXOO_LOCATION | grep '.sa' | head -n1 | cut -d'-' -f1)
# Check if no file was found # Check if no file was found
if [ -z "$latest_block" ]; then if [ -z "$latest_block" ]; then