• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Auto restart the Masternode

DrkMiner

Active member
To insure your MN is up all times or auto start after reboot, I wrote a small script that checks every 2 minutes if the Node is up and restart it if not.

Recently Digitaloncean been doing some upgrades and Nodes were rebooted.

Check if the service darkcoind is running and if not start it
1. Create a mn_autostart.sh file with this code:
Code:
#!/bin/sh
SERVICE='darkcoind'

if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
  echo "$SERVICE is already running!"
else
  ./darkcoind
fi
2. Upload to same directory as your ./darkcoind
3. Chomd file to 744
Run the script every 2 minutes - crontab
1. On your SSH screen type:

export EDITOR=nano
crontab -e

2. Paste the code at the end
Code:
*/2 * * * * sh /root/mn_autostart.sh >/dev/null 2>&1
3. Save and exit
4. Make sure you have the correct path to the script. If you login as a user you will have to change the dir from "root" to that user.​
 
Quite useful.

BTW, darkcoind does NOT need superuser-privileges, so better run it as a 'normal' user.
 
Back
Top