allow sudo call

This commit is contained in:
rootzoll 2021-07-02 14:20:06 +02:00
parent c02b2ad8cc
commit 83c2f042ae
2 changed files with 9 additions and 3 deletions

View File

@ -217,9 +217,9 @@ do
# check every 1min
recheckSync=$(($counter % 60))
if [ ${recheckSync} -eq 1 ]; then
source <(sudo -u admin /home/admin/config.scripts/network.monitor.sh peer-status)
source <(sudo /home/admin/config.scripts/network.monitor.sh peer-status)
echo "Blockchain Sync Monitoring: peers=${peers}"
if [ "${peers}" == "0" ]; then
if [ "${peers}" == "0" ] && [ "${running}" == "1" ]; then
echo "Blockchain Sync Monitoring: ZERO PEERS DETECTED .. doing out-of-band kickstart"
sudo /home/admin/config.scripts/network.monitor.sh peer-kickstart
fi

View File

@ -32,7 +32,13 @@ if [ "$1" = "peer-status" ]; then
# number of peers connected
running=1
peerNum=$(${network}-cli getnetworkinfo 2>/dev/null | grep "connections\"" | tr -cd '[[:digit:]]')
if [ "$EUID" -eq 0 ]; then
# sudo call
peerNum=$(sudo -u admin ${network}-cli getnetworkinfo 2>/dev/null | grep "connections\"" | tr -cd '[[:digit:]]')
else
# user call
peerNum=$(${network}-cli getnetworkinfo 2>/dev/null | grep "connections\"" | tr -cd '[[:digit:]]')
fi
if [ "${peerNum}" = "" ]; then
running=0
peerNum=0