diff options
Diffstat (limited to 'bin/ak-find-latest-mined-sblock')
-rwxr-xr-x | bin/ak-find-latest-mined-sblock | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/bin/ak-find-latest-mined-sblock b/bin/ak-find-latest-mined-sblock index cf25552..73bc67a 100755 --- a/bin/ak-find-latest-mined-sblock +++ b/bin/ak-find-latest-mined-sblock @@ -3,11 +3,11 @@ MINED_BLOCKS_DIR="/home/$USER/.arching-kaos/mined_blocks" cd $MINED_BLOCKS_DIR PROGRAM="$(basename $0)" declare -A counters -logitnowint(){ +logit(){ ak-logthis "$PROGRAM" "$1" "$2" } further(){ - # logitnowint "INFO" "Diving into $1" + # logit "INFO" "Diving into $1" lookfor $1 } @@ -15,7 +15,7 @@ lookfor(){ echo -n $1 | grep -e '[0-9a-f]\{128\}' > /dev/null if [ ! $? = 0 ] then - logitnowint "ERROR" "Oops!!! The argument passed, does not match the regular expression!" + logit "ERROR" "Oops!!! The argument passed, does not match the regular expression!" else counters[$CHAIN_PARENT]="$(expr ${counters[$CHAIN_PARENT]} + 1)" if [ ! $? = 0 ] @@ -23,39 +23,37 @@ lookfor(){ echo "$1, $counters[$1]" exit 1 fi - logitnowint "INFO" "Accessing file: $1" + logit "INFO" "Accessing file: $1" # echo "$1 file:" # cat "$1" | jq NEXT_TARGET="$(cat "$1" | jq | grep previous | tr -d ' ' | sed -e 's/previous//g; s/[",:]//g;')" if [ ! "$NEXT_TARGET" = "" ] then - logitnowint "INFO" "Found previous: $NEXT_TARGET" + logit "INFO" "Found previous: $NEXT_TARGET" if [ ! -f "$NEXT_TARGET" ] then - logitnowint "WARNING" "Could not find $NEXT_TARGET" + logit "WARNING" "Could not find $NEXT_TARGET" else further "$NEXT_TARGET" fi else - - logitnowint "WARNING" "No next target found. So long for $1" + logit "WARNING" "No next target found. So long for $1" fi fi } - ls -1 > tmplistblock while IFS="" read -r p || [ -n "$p" ] do # if [ ! "$p" = "" ] && [ ! "$p" = "tmplistblock" ] if [ "$(echo $p | tr -d '\n' | wc -c)" = 128 ] then - logitnowint "INFO" "Investigating $p..." + logit "INFO" "Investigating $p..." export CHAIN_PARENT="$p" counters[$CHAIN_PARENT]=1 lookfor "$p" else - logitnowint "WARNING" "Nothing to do with $p" + logit "WARNING" "Nothing to do with $p" fi done < tmplistblock rm tmplistblock |