add target

This commit is contained in:
rootzoll
2021-06-21 01:17:38 +02:00
parent 3c55909eb4
commit c1692e8069
4 changed files with 3 additions and 60 deletions

View File

@@ -45,7 +45,7 @@ if [ "${state}" = "copysource" ]; then
fi
# special state: copytarget
source <(/home/admin/config.scripts/blitz.copyblockchain.sh status)
source <(/home/admin/config.scripts/blitz.copychain.sh status)
if [ "${copyInProgress}" = "1" ]; then
echo "Detected interrupted COPY blochain process ..."
/home/admin/config.scripts/blitz.copychain.sh target

View File

@@ -1,57 +0,0 @@
#!/bin/bash
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
echo "# managing the copy of blockchain data over LAN"
echo "# blitz.copyblockchain.sh [status]"
echo "error='missing parameters'"
exit 1
fi
# load basic system settings
source /home/admin/raspiblitz.info 2>/dev/null
source /mnt/hdd/raspiblitz.conf 2>/dev/null
# check that blockchain is set & supported
if [ "${network}" != "bitcoin" ] && [ "${network}" != "litecoin" ]; then
echo "blockchain='{$network}'"
echo "error='blockchain type missing or not supported'"
exit 1
fi
# check that HDD is available
isMounted=$(sudo df | grep -c /mnt/hdd)
if [ "${isMounted}" != "1" ]; then
echo "error='no datadrive is mounted'"
exit 1
fi
###################
# STATUS
###################
# check if copy is in progress
copyBeginTime=$(cat /mnt/hdd/${network}/copy_begin.time 2>/dev/null | tr -cd '[[:digit:]]')
if [ ${#copyBeginTime} -eq 0 ]; then
copyBeginTime=0
fi
copyEndTime=$(cat /mnt/hdd/${network}/copy_end.time 2>/dev/null | tr -cd '[[:digit:]]')
if [ ${#copyEndTime} -eq 0 ]; then
copyEndTime=0
fi
copyInProgress=0
if [ ${copyBeginTime} -gt ${copyEndTime} ]; then
copyInProgress=1
fi
# output status data & exit
if [ "$1" = "status" ]; then
echo "# blitz.copyblockchain.sh"
echo "copyInProgress=${copyInProgress}"
echo "copyBeginTime=${copyBeginTime}"
echo "copyEndTime=${copyEndTime}"
exit 1
fi
# if no other
echo "error='unknown command'"
exit 1

View File

@@ -45,7 +45,7 @@ fi
# output status data & exit
if [ "$1" = "status" ]; then
echo "# blitz.copyblockchain.sh"
echo "# blitz.copychain.sh"
echo "copyInProgress=${copyInProgress}"
echo "copyBeginTime=${copyBeginTime}"
echo "copyEndTime=${copyEndTime}"

View File

@@ -35,7 +35,7 @@ if [ "${syncProgress}" != "" ] && [ "${network}" == "bitcoin" ] && [ ${syncProgr
CHOICESUB=$(dialog --backtitle "RaspiBlitz" --clear --title " Blockchain Sync/Validation " --menu "\nYour Blockchain sync is just at ${syncProgress}%\nThe full validation might take multiple days to finish.\n\nHow do you want to proceed:" 13 63 7 "${OPTIONS[@]}" 2>&1 >/dev/tty)
if [ "${CHOICESUB}" == "COPY" ]; then
/home/admin/config.scripts/blitz.copychain.sh
/home/admin/config.scripts/blitz.copychain.sh target
fi
exit 1