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

How to check "auto restart" script

I want to check my auto restart script is working ,,,

does it make any difference if i manually stop using putty or my windows wallet ?

cheers
 
you need to stop the deamon from your remote server and wait a bit checking if the proces started.
I don`t know what the cycle you`ve setuped but if lets say after 10-15 min it does not start better start it manually so you`ll not get out of queue ;)
 
this is how i installed the reboot script , i haven't missed one payment since :
https://status.bolehvpn.net/2016/02/07/what-is-a-dash-masternode-and-how-do-i-set-up-one/
i'm a linux noob and was very easy for me , thx to Reuben from BolehVPN

Step 8 Optional: Auto restart of dashd in the event of crash
You can also install a monitor to auto restart dash if it crashes. This is optional. The below is taken from Moomoocow’s post:

Install Monit

sudo apt-get install monit

Create file /home/user/.dash/start_dashd.sh (change user to yours)

#!/bin/bash
/bin/su user -c '/home/user/.dash/dashd 2>&1 >> /home/user/.dash/rc.local.log'

Make it executable

chmod 755 /home/user/.dash/start_dashd.sh

Edit the file /etc/monit/monitrc

sudo nano /etc/monit/monitrc

Edit the file as follows:

# uncomment these lines
set httpd port 2812 and
use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server and
# add this to bottom - change user to yours
check process dashd with pidfile /home/user/.dash/dashd.pid
start program = "/home/user/.dash/start_dashd.sh" with timeout 60 seconds
stop program = "/bin/su user -c /home/user/.dash/dash-cli stop"

Load the new configuration

sudo monit reload

Enable the watchdog

sudo monit start dashd

That’s it. You only have to do above once.
You can check monit’s status by typing below:

sudo monit status

It’ll keep your dashd running for you (across reboots too, no need for any crons or scripts) and keep you from fighting with your chosen OS. Monit only runs once a minute, so be patient if you’re waiting for it to do something.

If you need proof it works, once you see your dashd in the ‘sudo monit status‘ output, you can test it by simply stopping your dashd (dash-cli stop) — within 2 minutes it’ll start it back up,
 
Last edited:
Is Monit autostart above still working with 12.1 after changing paths from .dash to .dashcore?
 
Is Monit autostart above still working with 12.1 after changing paths from .dash to .dashcore?

I was not able to tweak that to get monit to work with 12.1. After getting my masternode up and running on 12.1, I then decided I was ready to re-enable the monit monitoring. I updated the last three lines of /etc/monit/monitrc for the new .dashcore location:

check process dashd with pidfile /home/myusername/.dashcore/dashd.pid
start program = "/home/myusername/.dashcore/start_dashd.sh"
stop program = "/home/myusername/.dashcore/dash-cli stop"

Then, since I wasn't confident that dashman is ready to work well with 12.1, I changed start_dashd.sh to simply start dashd daemon instead of dashman. Like this:

#!/bin/bash
/bin/su myusername -c '/home/myusername/.dashcore/dashd -daemon'

I then issued the command to start monitoring:

sudo monit start dashd

At which point monit immediately restarted dashd -- I presume to have the process under its control..

Very shortly after, my masternode reported down and wouldn't come back up despite some fiddling. I wish I could remember what masternode debug told me... (arggh, I know I'm not being helpful).

Taking monit out of the loop, and I'm back up with my unmonitored masternode.

I love the peace of mind of a monit'd Masternode, any ideas?

Best,
Chris Muller
 
Or, create a file /home/user/testdashd

#!/bin/bash
if ! [ `pidof dashd` ] ;then
mail -s "MN1: dashd died" [email protected] < /dev/null
/home/user/dashd > /dev/null
fi​

make it executable

chmod 755 /home/user/testdashd​

then create a cron job; crontab -e

*/5 * * * * /home/user/testdashd > /dev/null​
 

For v0.12.1 try to change it like this :

Move dashd & dash-cli into .dashcore folder and make them executable

For this script to work according below specs both dashd & dash-cli have to be installed and made executable inside .dashcore folder !!

Install Monit

sudo apt-get install monit

Create file /home/user/.dashcore/start_dashd.sh (change user to yours)

#!/bin/bash
/bin/su user -c '/home/user/.dashcore/dashd 2>&1 >> /home/user/.dashcore/rc.local.log'

Make it executable

chmod 755 /home/user/.dashcore/start_dashd.sh

Edit the file /etc/monit/monitrc

sudo nano /etc/monit/monitrc

Edit the file as follows:

set httpd port 2812 and
use address localhost # only accept connection from localhost
allow localhost # allow localhost to connect to the server and
check process dashd with pidfile /home/user/.dashcore/dashd.pid
start program = "/home/user/.dashcore/start_dashd.sh" with timeout 60 seconds
stop program = "/bin/su user -c /home/user/.dashcore/dash-cli stop"

Use ALT & X to save


sudo monit reload

Make sure dashd is already running before doing next commands !

sudo monit start dashd
sudo monit status


That’s it. You only have to do above once.

It’ll keep your dashd running for you (across reboots too, no need for any crons or scripts) and keep you from fighting with your chosen OS. Monit only runs once a minute, so be patient if you’re waiting for it to do something.

If you need proof it works, once you see your dashd in the ‘sudo monit status‘ output, you can test it by simply stopping your dashd (dash-cli stop) — within 2 minutes it’ll start it back up


credits : studioz & Reuben from BolehVPN
 
Last edited:
Back
Top