mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-28 16:58:03 +01:00
Reduce use of "sudo" (#4522)
This commit is contained in:
parent
e4c51fe22e
commit
22a95cae08
6 changed files with 19 additions and 12 deletions
|
@ -358,7 +358,7 @@ else
|
||||||
fileFlagExists=$(sudo ls /mnt/hdd/app-storage/electrs/initial-sync.done 2>/dev/null | grep -c 'initial-sync.done')
|
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
|
if [ "${ElectRS}" == "on" ] && [ $fileFlagExists -eq 0 ]; then
|
||||||
error=""
|
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
|
if [ ${#infoSync} -gt 0 ]; then
|
||||||
appInfoLine="Electrum: ${infoSync}"
|
appInfoLine="Electrum: ${infoSync}"
|
||||||
fi
|
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')
|
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
|
if [ "${fulcrum}" == "on" ] && [ $fileFlagExists -eq 0 ]; then
|
||||||
error=""
|
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
|
if [ ${#infoSync} -gt 0 ]; then
|
||||||
appInfoLine="Fulcrum: ${infoSync}"
|
appInfoLine="Fulcrum: ${infoSync}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -66,7 +66,7 @@ RaspiBlitz image to your SD card.
|
||||||
}
|
}
|
||||||
|
|
||||||
# get status of txindex
|
# 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=()
|
||||||
#OPTIONS+=(HARDWARE "Run Hardwaretest")
|
#OPTIONS+=(HARDWARE "Run Hardwaretest")
|
||||||
|
|
|
@ -717,6 +717,7 @@ do
|
||||||
if [ ${recheckRAID} -eq 1 ]; then
|
if [ ${recheckRAID} -eq 1 ]; then
|
||||||
|
|
||||||
# check if BTRTFS raid is active & scrub
|
# check if BTRTFS raid is active & scrub
|
||||||
|
logger -p info "background.sh - RAID data check"
|
||||||
source <(/home/admin/config.scripts/blitz.datadrive.sh status)
|
source <(/home/admin/config.scripts/blitz.datadrive.sh status)
|
||||||
if [ "${isBTRFS}" == "1" ] && [ "${isRaid}" == "1" ]; then
|
if [ "${isBTRFS}" == "1" ] && [ "${isRaid}" == "1" ]; then
|
||||||
echo "STARTING BTRFS RAID DATA CHECK ..."
|
echo "STARTING BTRFS RAID DATA CHECK ..."
|
||||||
|
|
|
@ -148,13 +148,12 @@ if [ "$2" = "info" ]; then
|
||||||
if [ "$1" == "signet" ]; then
|
if [ "$1" == "signet" ]; then
|
||||||
subfolder="signet/"
|
subfolder="signet/"
|
||||||
fi
|
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
|
if [ "${btc_blocks_data_kb}" == "" ]; then
|
||||||
btc_blocks_data_kb="0"
|
btc_blocks_data_kb="0"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# print data
|
|
||||||
|
|
||||||
# parse data
|
# parse data
|
||||||
btc_blocks_headers=$(echo "${blockchaininfo}" | jq -r '.headers')
|
btc_blocks_headers=$(echo "${blockchaininfo}" | jq -r '.headers')
|
||||||
btc_blocks_verified=$(echo "${blockchaininfo}" | jq -r '.blocks')
|
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
|
if [ "$(cat /mnt/hdd/raspiblitz.conf | grep -c "^runBehindTor=on")" != "0" ]; then
|
||||||
addressFormat="tor"
|
addressFormat="tor"
|
||||||
else
|
else
|
||||||
source <(sudo /home/admin/config.scripts/internet.sh status global)
|
source <(/home/admin/config.scripts/internet.sh status global)
|
||||||
if [ "${ipv6}" == "off" ]; then
|
if [ "${ipv6}" == "off" ]; then
|
||||||
addressFormat="ipv4"
|
addressFormat="ipv4"
|
||||||
else
|
else
|
||||||
|
|
|
@ -218,7 +218,7 @@ if [ "$1" = "status" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# try to detect if its an SSD
|
# 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}"
|
echo "isSMART=${isSMART}"
|
||||||
isSSD=1
|
isSSD=1
|
||||||
isRotational=$(echo "${smartCtlA}" | grep -c "Rotation Rate:")
|
isRotational=$(echo "${smartCtlA}" | grep -c "Rotation Rate:")
|
||||||
|
@ -458,7 +458,7 @@ if [ "$1" = "status" ]; then
|
||||||
fi
|
fi
|
||||||
echo "hddRaspiVersion='${hddRaspiVersion}'"
|
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
|
# try to detect if its an SSD
|
||||||
isSMART=$(echo "${smartCtlA}" | grep -c "Serial Number:")
|
isSMART=$(echo "${smartCtlA}" | grep -c "Serial Number:")
|
||||||
|
|
|
@ -30,7 +30,14 @@ if [ "$1" = "status" ]; then
|
||||||
|
|
||||||
echo "##### STATUS TXINDEX"
|
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
|
if [ "${indexByteSize}" == "" ]; then
|
||||||
indexByteSize=0
|
indexByteSize=0
|
||||||
fi
|
fi
|
||||||
|
@ -44,8 +51,8 @@ if [ "$1" = "status" ]; then
|
||||||
# try to gather if still indexing
|
# try to gather if still indexing
|
||||||
source <(/home/admin/_cache.sh get btc_mainnet_blocks_headers)
|
source <(/home/admin/_cache.sh get btc_mainnet_blocks_headers)
|
||||||
blockchainHeight="${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')
|
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=$(sudo tail -n 200 /mnt/hdd/${network}${pathAdd}/debug.log | grep -c "txindex is enabled at height")
|
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
|
if [ ${#indexedToBlock} -eq 0 ] || [ ${indexFinished} -gt 0 ] || [ "${indexedToBlock}" = "${blockchainHeight}" ]; then
|
||||||
echo "isIndexed=1"
|
echo "isIndexed=1"
|
||||||
|
|
Loading…
Add table
Reference in a new issue