Skip to content
Permalink
Browse files

Merge pull request #54 from SINOVATEblockchain/assertCondition

sind node controller
  • Loading branch information...
crptec committed May 29, 2019
2 parents 92c3f07 + 2769c4a commit d24bd6b2859aa8c0347be80344ea59cfa2bc3415
Showing with 51 additions and 0 deletions.
  1. +50 −0 contrib/SIN/sin_check_restart.sh
  2. +1 −0 src/masternodeman.cpp
@@ -0,0 +1,50 @@
#!/bin/bash
## Change where files are located
sin_deamon_name="sind"
sin_deamon = "/root/SIN-core/src/sind"
sin_cli="/root/SIN-core/src/sin-cli"
##

function start_node() {
sleep 5
echo "restart sin deamon" >> ~/.sin/sin_control.log
eval $sin_deamon &
}

function stop_start_node() {
echo "kill process by name $sin_deamon" >> ~/.sin/sin_control.log
pgrep -f $sin_deamon_name | awk '{print "kill -9 " $1}' | sh >> ~/.sin/sin_control.log
sleep 5
echo "restart sin deamon" >> ~/.sin/sin_control.log
eval $sin_deamon &
}

DATE_WITH_TIME=`date "+%Y%m%d-%H:%M:%S"`
timeout --preserve-status 10 $sin_cli getblockcount
CHECK_SIN=$?
echo $CHECK_SIN >> ~/.sin/sin_control.log
if [ "$CHECK_SIN" -eq "0" ]; then
echo "$DATE_WITH_TIME sin deamon is active" >> ~/.sin/sin_control.log
fi

#node is stopped
if [ "$CHECK_SIN" -eq "1" ]; then
#find sind
SIND=`ps -e | grep $sin_deamon_name | wc -l`
if [ "$SIND" -eq "0" ]; then
start_node
else
stop_start_node
fi
fi

#command not found
if [ "$CHECK_SIN" -eq "127" ]; then
echo "Command not found. Please change the path of sin_deamon and sin_cli." >> ~/.sin/sin_control.log
fi

# node is frozen
if [ "$CHECK_SIN" -eq "143" ]; then
echo "$DATE_WITH_TIME sin deamon will be restarted...." >> ~/.sin/sin_control.log
stop_start_node
fi
@@ -221,6 +221,7 @@ void CMasternodeMan::CheckAndRemoveBurnFundNotUniqueNode(CConnman& connman)
/*
LogPrint(BCLog::MASTERNODE, "CMasternodeMan::CheckAndRemoveBurnFundNotUniqueNode -- reusing dest node: peer=%d addr=%s nRefCount=%d fNetworkNode=%$",pnode->GetId(), pnode->addr.ToString(), pnode->GetRefCount(), pnode->fNetworkNode, pnode->fInbound, pnode->fMasternode); }
*/
}
}
}
// looped through all nodes, release them

0 comments on commit d24bd6b

Please sign in to comment.
You can’t perform that action at this time.