Last active
May 15, 2017 10:36
-
-
Save mberry/db10762f32b00110a253524cb55fdcc6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#TODO: Restart if no response | |
leader=$(factom-cli get heights | grep Leader | cut -c 15-) | |
current=$(factom-cli get heights | grep Directory | cut -c 23-) | |
difference=$(($leader - $current)) | |
#echo Current Height: $current | |
#echo Leader Height: $leader | |
#echo Difference: $difference | |
if (($difference > 3)) | |
then | |
#echo $(date -u) ": Daemon behind leader height, checking if stalled..." >> ~/restart.log | |
sleep 10 | |
newcurrent=$(factom-cli get heights | grep Directory | cut -c 23-) | |
if ((($newcurrent - $current) < 5 )) | |
then | |
pkill factomd | |
sleep 10 | |
#open factomd as a normal bg process | |
factomd | |
#open in a detached screen session named fctd for later retrieval | |
#screen -dmS fctd factomd | |
#echo $(date) ": Restarted factomd" >> ~/restart.log | |
#else | |
#echo $(date) ": False alarm, blocks still processing" >> ~/restart.log | |
fi | |
fi | |
#api method | |
#curl -X POST -H 'Content-Type: application/json' -d '{"params":{},"method":"heights","jsonrpc":"2.0", "id":"1"}' localhost:8088/v2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment