mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-10-09 20:32:52 +02:00
fix errors when in a VM
This commit is contained in:
@@ -49,7 +49,7 @@ lnd_macaroon_dir="/home/bitcoin/.lnd/data/chain/${network}/${chain}net"
|
|||||||
# get uptime & load
|
# get uptime & load
|
||||||
load=$(w | head -n 1 | cut -d 'v' -f2 | cut -d ':' -f2)
|
load=$(w | head -n 1 | cut -d 'v' -f2 | cut -d ':' -f2)
|
||||||
|
|
||||||
# get CPU temp
|
# get CPU temp - no measurement in a VM
|
||||||
cpu=0
|
cpu=0
|
||||||
if [ -d "/sys/class/thermal/thermal_zone0/" ]; then
|
if [ -d "/sys/class/thermal/thermal_zone0/" ]; then
|
||||||
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
|
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
|
||||||
@@ -78,9 +78,9 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# get network traffic
|
# get network traffic
|
||||||
# ifconfig does not show eth0 on Armbian - get first traffic info
|
# ifconfig does not show eth0 on Armbian or in a VM - get first traffic info
|
||||||
isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian')
|
isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian')
|
||||||
if [ ${isArmbian} -gt 0 ]; then
|
if [ ${isArmbian} -gt 0 ] || [ ! -d "/sys/class/thermal/thermal_zone0/" ]; then
|
||||||
network_rx=$(ifconfig | grep -m1 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
|
network_rx=$(ifconfig | grep -m1 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
|
||||||
network_tx=$(ifconfig | grep -m1 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
|
network_tx=$(ifconfig | grep -m1 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
|
||||||
else
|
else
|
||||||
|
@@ -20,7 +20,7 @@ sudo chmod 777 -R /mnt/hdd/temp 2>/dev/null
|
|||||||
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
localip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||||
echo "localIP='${localip}'"
|
echo "localIP='${localip}'"
|
||||||
|
|
||||||
# temp
|
# temp - no measurement in a VM
|
||||||
tempC=0
|
tempC=0
|
||||||
if [ -d "/sys/class/thermal/thermal_zone0/" ]; then
|
if [ -d "/sys/class/thermal/thermal_zone0/" ]; then
|
||||||
tempC=$(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc)
|
tempC=$(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc)
|
||||||
|
Reference in New Issue
Block a user