Did this tool save you time, lots of headaches, or teach you something? Donations are appreciated for making your Wagerr experience much easier, please use my VULTR affiliate link or send $WGR to WagerrLiVo87tYRpLmwV3QJvB2sY58hS5f Want your own $WGR vanity address? Click here!

***Auto Setup***
Log into the server using ssh

wget -q https://raw.githubusercontent.com/TidalWavesNode/Auto-Restart-Masternode/master/auto.sh

bash auto.sh

Answer Yes to prompts (these were added so you know its working)

***If you do not have an existing crontab then the “normal” output of the script will say “no crontab for root” this is normal and the crontab file has been created and the crontask line has been added.***

*source https://github.com/TidalWavesNode/Auto-Restart-Masternode

***Manual Setup***
This will check to see if wagerrd is running every 30 minutes. If it is great, if not it will start automagically for you!

1. Create a mn_auto.sh file with this code in ~/wagerr-2.0.1/bin
cd ~/wagerr-2.0.1/bin
sudo nano (paste in below)


if ps ax | grep -v grep | grep $SERVICE > /dev/null
echo “Masternode is running! Yay!”

2. then Ctrl-X then Y and name mn_auto.sh

3. Change permissions of the file
chmod 744 mn_auto.sh

Use cron task to run the script
1. type:

export EDITOR=nano
sudo crontab -e

2. Add this to the end of the file #this will run every 30 minutes ****use only one of the lines****

*/30 * * * * ~/wagerr-2.0.1/bin/mn_auto.sh >> ~/wagerr-2.0.1/bin/cronlog/auto.log 2>&1 #logs output to auto.log
*/30 * * * * ~/wagerr-2.0.1/bin/mn_auto.sh >> /dev/null 2>&1 #no logs

3. Save and exit

4. Check to confirm it is working *change the crontab -e entry to */1 * * * * so this will run every 1 minute for testing then revert to whatever interval you want!
stop masternode
cd ~/wagerr-2.0.1/bin/
./wagerr-cli stop
cd ~/wagerr-2.0.1/bin/cronlog (* if the cronlog directory was not created use cmd mkdir cronlog)
watch cat auto.log (ctrl-c to break watch)
watch grep CRON /var/log/syslog (ctrl-c to break watch) #this will show all the times the cron job ran