From 8045b7b4cbcdc62467133ce3d2eb20635139079d Mon Sep 17 00:00:00 2001 From: rootzoll Date: Fri, 28 Feb 2020 21:40:05 +0100 Subject: [PATCH] adding --delete to rsync --- home.admin/XXcopyStation.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/home.admin/XXcopyStation.sh b/home.admin/XXcopyStation.sh index b83ae4755..c97b71b46 100755 --- a/home.admin/XXcopyStation.sh +++ b/home.admin/XXcopyStation.sh @@ -174,9 +174,10 @@ do fi # do the sync to the template folder for BITCOIN - rsync -a --info=progress2 ${pathBitcoinBlockchain}/chainstate ${pathBitcoinBlockchain}/blocks ${pathTemplateHDD}/bitcoin + rsync -a --info=progress2 --delete ${pathBitcoinBlockchain}/chainstate ${pathBitcoinBlockchain}/blocks ${pathTemplateHDD}/bitcoin - if [ -d "${pathLitecoinBlockchain}" ]; then + litecoindirsize=$(sudo du -s -b /mnt/hdd/bitcoin | awk '$1=$1' | cut -d " " -f1) + if [ -d "${pathLitecoinBlockchain}" ] && [ ${litecoindirsize} -gt 1000000000 ]; then # sync litecoin echo "# Syncing Litecoin ..." @@ -188,7 +189,7 @@ do sudo sed -i "s/^message=.*/message='Updating Template: Litecoin'/g" /home/admin/raspiblitz.info 2>/dev/null # do the sync to the template folder for LITECOIN - rsync -a --info=progress2 ${pathLitecoinBlockchain}/chainstate ${pathLitecoinBlockchain}/blocks ${pathTemplateHDD}/litecoin + rsync -a --info=progress2 --delete ${pathLitecoinBlockchain}/chainstate ${pathLitecoinBlockchain}/blocks ${pathTemplateHDD}/litecoin fi @@ -275,7 +276,7 @@ OK NO FORMAT - Please remove decive now. mountOK=$(lsblk -o NAME,MOUNTPOINT | grep "${detectedDrive}" | grep -c "/mnt/hdd2") if [ ${mountOK} -eq 1 ]; then sudo sed -i "s/^message=.*/message='Syncing Template -> ${partition}'/g" /home/admin/raspiblitz.info 2>/dev/null - rsync -a --info=progress2 ${pathTemplateHDD}/* /mnt/hdd2 + rsync -a --info=progress2 --delete ${pathTemplateHDD}/* /mnt/hdd2 sudo chmod -R 777 /mnt/hdd2 rm -r /mnt/hdd2/lost+found 2>/dev/null echo "${partition} " >> ./.syncinfo.tmp