Browse Source

fix errors when in a VM

master
openoms 6 years ago
parent
commit
b37d854eee
  1. 6
      home.admin/00infoBlitz.sh
  2. 2
      home.admin/config.scripts/blitz.statusscan.sh

6
home.admin/00infoBlitz.sh

@ -49,7 +49,7 @@ lnd_macaroon_dir="/home/bitcoin/.lnd/data/chain/${network}/${chain}net"
# get uptime & load
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
if [ -d "/sys/class/thermal/thermal_zone0/" ]; then
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
@ -78,9 +78,9 @@ else
fi
# 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')
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_tx=$(ifconfig | grep -m1 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
else

2
home.admin/config.scripts/blitz.statusscan.sh

@ -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'/')
echo "localIP='${localip}'"
# temp
# temp - no measurement in a VM
tempC=0
if [ -d "/sys/class/thermal/thermal_zone0/" ]; then
tempC=$(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc)

Loading…
Cancel
Save