set DATADIR in robot.sh

This commit is contained in:
2020-07-24 15:53:15 +02:00
parent 1d88888638
commit 3d19524380
+12 -6
View File
@@ -1,15 +1,21 @@
#!/bin/bash #!/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 then
find /opt/TOPISTO/data/btcspy/data/simpledb/blocks -type f -mtime +3 -exec rm {} \; find $DATADIR/simpledb/blocks -type f -mtime +3 -exec rm {} \;
find /opt/TOPISTO/data/btcspy/data/json -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 do
if [ ! -f /opt/TOPISTO/data/btcspy/data/json/$BLOCK.json ]; if [ ! -f $DATADIR/json/$BLOCK.json ];
then 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 fi
done done
fi fi