Skip to content

Instantly share code, notes, and snippets.

@lukestokes
Created February 1, 2018 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lukestokes/4e0348ae4bde2e0b518951899f51f831 to your computer and use it in GitHub Desktop.
Save lukestokes/4e0348ae4bde2e0b518951899f51f831 to your computer and use it in GitHub Desktop.
Make sure each smart node is running. If it's not, restart it.
#!/bin/bash
# makerun.sh
# Make sure the daemon is not stuck.
# Add the following to the crontab (i.e. crontab -e)
# */2 * * * * ~/smartcash/makerun.sh
PREFIX="0"
START_NUMBER=$(<~/smartcash/start_number.txt)
END_NUMBER=$(<~/smartcash/end_number.txt)
for (( number=$START_NUMBER; number<=$END_NUMBER; number++ ))
do
if [ $number -gt 9 ]
then
PREFIX=""
fi
NODE=$PREFIX$number
if ps aux | grep smartcashd | grep SmartNode$NODE > /dev/null
then
echo "SmartNode$NODE is running..."
else
~/smartcash/smart-start.sh $NODE
fi
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment