From 3d195243804832fa50672c4c5a495d2be1a2a2f5 Mon Sep 17 00:00:00 2001 From: MEUNIER Thibaud Date: Fri, 24 Jul 2020 15:53:15 +0200 Subject: [PATCH] set DATADIR in robot.sh --- scripts/robot.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/robot.sh b/scripts/robot.sh index 6c0fa94..98b3415 100755 --- a/scripts/robot.sh +++ b/scripts/robot.sh @@ -1,15 +1,21 @@ #!/bin/bash -if [ -d /opt/TOPISTO/data/btcspy ]; +DATADIR=/opt/TOPISTO/data/btcspy/data + +if [[ $# -eq 1 ]]; then + DATADIR=$1 +fi + +if [ -d $DATADIR ]; then - find /opt/TOPISTO/data/btcspy/data/simpledb/blocks -type f -mtime +3 -exec rm {} \; - find /opt/TOPISTO/data/btcspy/data/json -type f -mtime +3 -exec rm {} \; + find $DATADIR/simpledb/blocks -type f -mtime +3 -exec rm {} \; + find $DATADIR/json -type f -mtime +3 -exec rm {} \; - for BLOCK in `ls /opt/TOPISTO/data/btcspy/data/simpledb/blocks` + for BLOCK in `ls $DATADIR/simpledb/blocks` do - if [ ! -f /opt/TOPISTO/data/btcspy/data/json/$BLOCK.json ]; + if [ ! -f $DATADIR/json/$BLOCK.json ]; then - /tmp/btcspy/bin/block2json $BLOCK > /opt/TOPISTO/data/btcspy/data/json/$BLOCK.json + /tmp/btcspy/bin/block2json $DATADIR/simpledb/blocks/$BLOCK > $DATADIR/json/$BLOCK.json fi done fi