#!/bin/bash # Récupération du chemin absolut du répertoir du script actuel GPATH="$( cd "$(dirname "$0")" ; pwd -P )/.." if [[ $1 ]]; then cacheID=$1 cacheFile="$GPATH/cache/bk-walletsUp-$cacheID" else cacheFile=$(ls $GPATH/cache/bk-walletsUp-* | tail -n1) cacheID=$(echo $cacheFile | awk -F '-' '{ print $NF }') fi if [[ -f $cacheFile ]]; then rm -f $GPATH/cache/walletsUp-* cp $cacheFile $GPATH/cache/walletsUp-$cacheID cp $GPATH/db/bk-daily.json-$cacheID $GPATH/db/daily.json else echo "Aucun cache existant au bloc $cacheID" exit 1 fi