diff --git a/home.admin/00infoBlitz.sh b/home.admin/00infoBlitz.sh index c12e5e18f..695bb2052 100755 --- a/home.admin/00infoBlitz.sh +++ b/home.admin/00infoBlitz.sh @@ -358,7 +358,7 @@ else fileFlagExists=$(sudo ls /mnt/hdd/app-storage/electrs/initial-sync.done 2>/dev/null | grep -c 'initial-sync.done') if [ "${ElectRS}" == "on" ] && [ $fileFlagExists -eq 0 ]; then error="" - source <(sudo /home/admin/config.scripts/bonus.electrs.sh status-sync 2>/dev/null) + source <(/home/admin/config.scripts/bonus.electrs.sh status-sync 2>/dev/null) if [ ${#infoSync} -gt 0 ]; then appInfoLine="Electrum: ${infoSync}" fi @@ -368,7 +368,7 @@ else fileFlagExists=$(sudo ls /mnt/hdd/app-storage/fulcrum/initial-sync.done 2>/dev/null | grep -c 'initial-sync.done') if [ "${fulcrum}" == "on" ] && [ $fileFlagExists -eq 0 ]; then error="" - source <(sudo /home/admin/config.scripts/bonus.fulcrum.sh status-sync 2>/dev/null) + source <(/home/admin/config.scripts/bonus.fulcrum.sh status-sync 2>/dev/null) if [ ${#infoSync} -gt 0 ]; then appInfoLine="Fulcrum: ${infoSync}" fi diff --git a/home.admin/98repairMenu.sh b/home.admin/98repairMenu.sh index d22457493..66c743f7c 100755 --- a/home.admin/98repairMenu.sh +++ b/home.admin/98repairMenu.sh @@ -66,7 +66,7 @@ RaspiBlitz image to your SD card. } # get status of txindex -source <(/home/admin/config.scripts/network.txindex.sh status) +source <(sudo /home/admin/config.scripts/network.txindex.sh status) OPTIONS=() #OPTIONS+=(HARDWARE "Run Hardwaretest") diff --git a/home.admin/_background.sh b/home.admin/_background.sh index 9de0e4182..611e3a660 100755 --- a/home.admin/_background.sh +++ b/home.admin/_background.sh @@ -717,6 +717,7 @@ do if [ ${recheckRAID} -eq 1 ]; then # check if BTRTFS raid is active & scrub + logger -p info "background.sh - RAID data check" source <(/home/admin/config.scripts/blitz.datadrive.sh status) if [ "${isBTRFS}" == "1" ] && [ "${isRaid}" == "1" ]; then echo "STARTING BTRFS RAID DATA CHECK ..." diff --git a/home.admin/config.scripts/bitcoin.monitor.sh b/home.admin/config.scripts/bitcoin.monitor.sh index 950628bf6..3b9ad0b65 100755 --- a/home.admin/config.scripts/bitcoin.monitor.sh +++ b/home.admin/config.scripts/bitcoin.monitor.sh @@ -148,13 +148,12 @@ if [ "$2" = "info" ]; then if [ "$1" == "signet" ]; then subfolder="signet/" fi - btc_blocks_data_kb=$(sudo du -s /mnt/hdd/bitcoin/${subfolder}blocks 2>/dev/null | cut -f1) + + btc_blocks_data_kb=$(du -s /mnt/hdd/bitcoin/${subfolder}blocks | cut -f1) if [ "${btc_blocks_data_kb}" == "" ]; then btc_blocks_data_kb="0" fi - # print data - # parse data btc_blocks_headers=$(echo "${blockchaininfo}" | jq -r '.headers') btc_blocks_verified=$(echo "${blockchaininfo}" | jq -r '.blocks') @@ -257,7 +256,7 @@ if [ "$2" = "peer-kickstart" ]; then if [ "$(cat /mnt/hdd/raspiblitz.conf | grep -c "^runBehindTor=on")" != "0" ]; then addressFormat="tor" else - source <(sudo /home/admin/config.scripts/internet.sh status global) + source <(/home/admin/config.scripts/internet.sh status global) if [ "${ipv6}" == "off" ]; then addressFormat="ipv4" else diff --git a/home.admin/config.scripts/blitz.datadrive.sh b/home.admin/config.scripts/blitz.datadrive.sh index 030a054a5..14e444193 100755 --- a/home.admin/config.scripts/blitz.datadrive.sh +++ b/home.admin/config.scripts/blitz.datadrive.sh @@ -218,7 +218,7 @@ if [ "$1" = "status" ]; then fi # try to detect if its an SSD - isSMART=$(sudo smartctl -a /dev/${hdd} | grep -c "Serial Number:") + isSMART=$(smartctl -a /dev/${hdd} | grep -c "Serial Number:") echo "isSMART=${isSMART}" isSSD=1 isRotational=$(echo "${smartCtlA}" | grep -c "Rotation Rate:") @@ -458,7 +458,7 @@ if [ "$1" = "status" ]; then fi echo "hddRaspiVersion='${hddRaspiVersion}'" - smartCtlA=$(sudo smartctl -a /dev/${hdd} | tr -d '"') + smartCtlA=$(smartctl -a /dev/${hdd} | tr -d '"') # try to detect if its an SSD isSMART=$(echo "${smartCtlA}" | grep -c "Serial Number:") diff --git a/home.admin/config.scripts/network.txindex.sh b/home.admin/config.scripts/network.txindex.sh index 3b371ce6d..d7655bf2d 100755 --- a/home.admin/config.scripts/network.txindex.sh +++ b/home.admin/config.scripts/network.txindex.sh @@ -30,7 +30,14 @@ if [ "$1" = "status" ]; then echo "##### STATUS TXINDEX" - indexByteSize=$(sudo du -s /mnt/hdd/bitcoin/indexes/txindex 2>/dev/null | cut -f1) + # check user is root + if [ "$EUID" -ne 0 ]; then + logger "FAIL: network.txindex.sh status needs sudo" + echo "error='missing sudo'" + exit 1 + fi + + indexByteSize=$(du -s /mnt/hdd/bitcoin/indexes/txindex 2>/dev/null | cut -f1) if [ "${indexByteSize}" == "" ]; then indexByteSize=0 fi @@ -44,8 +51,8 @@ if [ "$1" = "status" ]; then # try to gather if still indexing source <(/home/admin/_cache.sh get btc_mainnet_blocks_headers) blockchainHeight="${btc_mainnet_blocks_headers}" - indexedToBlock=$(sudo tail -n 200 /mnt/hdd/${network}${pathAdd}/debug.log | grep "Syncing txindex with block chain from height" | tail -n 1 | cut -d " " -f 9 | sed 's/[^0-9]*//g') - indexFinished=$(sudo tail -n 200 /mnt/hdd/${network}${pathAdd}/debug.log | grep -c "txindex is enabled at height") + indexedToBlock=$(tail -n 200 /mnt/hdd/${network}${pathAdd}/debug.log | grep "Syncing txindex with block chain from height" | tail -n 1 | cut -d " " -f 9 | sed 's/[^0-9]*//g') + indexFinished=$(tail -n 200 /mnt/hdd/${network}${pathAdd}/debug.log | grep -c "txindex is enabled at height") if [ ${#indexedToBlock} -eq 0 ] || [ ${indexFinished} -gt 0 ] || [ "${indexedToBlock}" = "${blockchainHeight}" ]; then echo "isIndexed=1"