Author

Topic: [ANN][DASH] Dash (dash.org) | First Self-Funding Self-Governing Crypto Currency - page 1904. (Read 9723748 times)

legendary
Activity: 1382
Merit: 1002
....

Just wanted to give you a special thanks mate! Your scripts are going to be lifesavers for many happy masternode users Wink
sr. member
Activity: 263
Merit: 250
bovine quadruped, professional loafer, dash dev
Guys if you continue like that... one day we will have Autoupdating, Autostarting, Autorestarting, self-sustainable MNs

Me like it Cheesy


Nothing replaces having a full-time admin with a monitoring network. Wink
sr. member
Activity: 434
Merit: 250
Quantum entangled and jump drive assisted messages
Rux
legendary
Activity: 1291
Merit: 1024
https://crypto.ba
Guys if you continue like that... one day we will have Autoupdating, Autostarting, Autorestarting, self-sustainable MNs

Me like it Cheesy
sr. member
Activity: 263
Merit: 250
bovine quadruped, professional loafer, dash dev
I set this up to run every 10 minutes, just because it will be a pain if you are updating and every minute it tries to restart dashd.  If you want to run with UdjinM6's suggestion with the crontab start with a */10 for 10 minutes so you don't have to stop the crontab everytime you update your node.

Why not just put "rm dashd" as the first line of your update script?  Basically pull the rug out from under the crontab, so that it will not be able to start up again while you're in the process of updating.  Once you've put an (updated) dashd back in the same spot, the crontab should continue to work its magic as usual.
The questions are: How long does it take to shutdown dashd? and How fast can you remove the dashd after it is shutdown?  If it takes 30 seconds you have a 50/50 shot with a 1 minute restart.  I think we do have about an hour that you can be down before you have to to a local start.  So every 10 minutes isn't really a big deal.

The best way to control dedicated cron jobs like this is through an intermediary file.

Code:
*/1 * * * *  [ -f /home/dashuser/.dash/dashd_enable ] && /home/dashuser/mn_watch.sh >/dev/null 2>&1

Then you can ignore cron and just do

Code:
touch ~/.dash/dashd_enable

to monitor/auto-restart and

Code:
rm ~/.dash/dashd_enable

when you want cron to keep its mitts off your procs.

--

Also, adding logging-on-action to mn_watch.sh and redirecting to a logfile is a good idea.  You want to know how often this happens.

Code:
#!/bin/bash
if [ -z `pidof dashd` ]; then
echo "$(date +%Y-%m-%d\ %H:%m:%S\ %Z) - restarting dashd"
/home/dashuser/dashd 2>&1 >/dev/null
fi

(dashd >/dev/null not a big deal, it has it's own logging)

then

Code:
*/1 * * * *  [ -f /home/dashuser/.dash/dashd_enable ] && /home/dashuser/mn_watch.sh >/home/dashuser/mn_watch.log 2>&1
hero member
Activity: 826
Merit: 502
I set this up to run every 10 minutes, just because it will be a pain if you are updating and every minute it tries to restart dashd.  If you want to run with UdjinM6's suggestion with the crontab start with a */10 for 10 minutes so you don't have to stop the crontab everytime you update your node.

Why not just put "rm dashd" as the first line of your update script?  Basically pull the rug out from under the crontab, so that it will not be able to start up again while you're in the process of updating.  Once you've put an (updated) dashd back in the same spot, the crontab should continue to work its magic as usual.
The questions are: How long does it take to shutdown dashd? and How fast can you remove the dashd after it is shutdown?  If it takes 30 seconds you have a 50/50 shot with a 1 minute restart.  I think we do have about an hour that you can be down before you have to to a local start.  So every 10 minutes isn't really a big deal.
sr. member
Activity: 263
Merit: 250
bovine quadruped, professional loafer, dash dev
Update script updated (through the power of scripting!)

UPDATES
  • Will now attempt to locate where you've installed your dashd/dash-cli
  • Shows pretty output of what its done (and where it's done it!)
BUGS
  • Probably
  • Still only works on Linuxes
  • Still can't deliver beers on demand
  • Others you haven't told me about yet



get it at https://github.com/moocowmoo/dashman

And let me know if you run into trouble!

full member
Activity: 133
Merit: 100
I set this up to run every 10 minutes, just because it will be a pain if you are updating and every minute it tries to restart dashd.  If you want to run with UdjinM6's suggestion with the crontab start with a */10 for 10 minutes so you don't have to stop the crontab everytime you update your node.

Why not just put "rm dashd" as the first line of your update script?  Basically pull the rug out from under the crontab, so that it will not be able to start up again while you're in the process of updating.  Once you've put an (updated) dashd back in the same spot, the crontab should continue to work its magic as usual.
full member
Activity: 194
Merit: 100
Our build system now produce linux files that are not recognized by Ubuntu file explorer as executables though they are.
I wrote yet another simple script  Grin to install dash-qt from downloaded archive and to give it a nice icon.
Here is what you need to do:

1) After you extracted downloaded archive you should have dash-0.12.0 folder somewhere.
Go inside it, create a file named install_dash_qt.sh and edit it with your favorite editor:

Code:
#!/bin/bash
su -c 'install -m 0755 -o root -g root -t /usr/local/bin bin/dash-qt'
echo "[Desktop Entry]
Name=Dash-Qt
Comment=Dash - Reinventing Cryptocurrency https://www.dashpay.io
Type=Application
Exec=dash-qt %u
Terminal=false
Icon=/usr/share/pixmaps/dash128.xpm
MimeType=x-scheme-handler/dash
Categories=Applications;Finance;" > ~/Desktop/Dash-Qt.desktop
chmod u+x ~/Desktop/Dash-Qt.desktop
sudo cp ~/Desktop/Dash-Qt.desktop /usr/share/applications/
sudo wget -O /usr/share/pixmaps/dash128.xpm https://github.com/dashpay/dash/raw/master/share/pixmaps/bitcoin128.xpm

2) Right click on empty space in that folder and choose "Open in Terminal". In command line issue:
Code:
chmod u+x install_dash_qt.sh
to make file executable and
Code:
./install_dash_qt.sh
to run it.

Enter your password and shortly after you should have a nice icon on your Desktop and the same icon in Applications.

Enjoy! Smiley

PS. This script reguires wget. Install it first if you don't have it already
Code:
sudo apt-get install wget

Nice! That worked like a charm
legendary
Activity: 1318
Merit: 1040
Our build system now produce linux files that are not recognized by Ubuntu file explorer as executables though they are.
I wrote yet another simple script  Grin to install dash-qt from downloaded archive and to give it a nice icon.
Here is what you need to do:

1) After you extracted downloaded archive you should have dash-0.12.0 folder somewhere.
Go inside it, create a file named install_dash_qt.sh and edit it with your favorite editor:

Code:
#!/bin/bash
sudo -s install -m 0755 -o root -g root -t /usr/local/bin bin/dash-qt
echo "[Desktop Entry]
Name=Dash-Qt
Comment=Dash - Reinventing Cryptocurrency https://www.dashpay.io
Type=Application
Exec=dash-qt %u
Terminal=false
Icon=/usr/share/pixmaps/dash128.xpm
MimeType=x-scheme-handler/dash
Categories=Applications;Finance;" > ~/Desktop/Dash-Qt.desktop
chmod u+x ~/Desktop/Dash-Qt.desktop
sudo cp ~/Desktop/Dash-Qt.desktop /usr/share/applications/
sudo wget -O /usr/share/pixmaps/dash128.xpm https://github.com/dashpay/dash/raw/master/share/pixmaps/bitcoin128.xpm

2) Right click on empty space in that folder and choose "Open in Terminal". In command line issue:
Code:
chmod u+x install_dash_qt.sh
to make file executable and
Code:
./install_dash_qt.sh
to run it.

Enter your password and shortly after you should have a nice icon on your Desktop and the same icon in Applications.

Enjoy! Smiley

PS. This script reguires wget. Install it first if you don't have it already
Code:
sudo apt-get install wget

EDIT:
"su -c" requires you to set root password which "normal"/non-developer users do not have at all (by ubuntu's default)
Changed script to use "sudo -s" instead, give it a try if you had problems before
legendary
Activity: 1318
Merit: 1040

I don't think so  Roll Eyes

Code:
man crontab
snip
UdjinM6, I do believe the crontab method is indeed the most stable way of doing this and this should work.  I am probably thinking this is harder than it is. But I have struggled in the past to get permissions of the crontab user, file permissions, and directory just right so everything runs.  Just trying to save someone else a little of that time I wasted...  

No problems at all doing it in another way.  Smiley
I didn't mean to force everyone to use my script, it was just few statements in your post that doesn't feel like they are 100% correct  Roll Eyes
But yeah, there are multiple ways to achive the same result and there could be some unexpected troubles using either method.

EDIT: so, once again, no troubles and thank you for providing alternative version that worked for you.  Smiley
legendary
Activity: 1260
Merit: 1001
How to start dashd automatically again after it crashed.

run:
Code:
crontab -e

add line:
Code:
*/1 * * * * /home/dashuser/mn_watch.sh >/dev/null 2>&1

use any editor you like and save this as "mn_watch.sh" file in user "dashuser" home directory:
Code:
#!/bin/bash
if [ -z `pidof dashd` ]; then
/home/dashuser/dashd
fi

add executable flag:
Code:
chmod u+x mn_watch.sh


PS. Use appropriate username, not "dashuser" from my example Wink
I also assumed that dashd is located in your user home directory, change path if needed.

PPS. not tested but should work  Roll Eyes

EDIT: ooops, tested and fixed  Smiley

I have an existential crisis with this.  If the daemon should stop but nobody is around to witness it, did it really stop?  How will we ever know?
sr. member
Activity: 409
Merit: 250
.......
Actually, crontabs may require a restart or server reboot.  Might also need to run with sudo crontab -e if running server as root.

..A server I rented didn't have crontab installed so this isn't always a no brainer...

If you don't have crontab installed, try this:

Code:
apt-get update
apt-get upgrade
apt-get install cron
Then you need to reboot for the cron process to take effect.
Add your crontab with crontab -e or sudo crontab -e
Then activate your crontab.  I think sudo service cron restart

Then to stop you need to edit the crontab and then restart the cron service.  Seems more complicated to me.

I don't think so  Roll Eyes

Code:
man crontab
snip
UdjinM6, I do believe the crontab method is indeed the most stable way of doing this and this should work.  I am probably thinking this is harder than it is. But I have struggled in the past to get permissions of the crontab user, file permissions, and directory just right so everything runs.  Just trying to save someone else a little of that time I wasted... 
Thanks so much guys, will try this out after some good night sleep. Im shure this will work out just fine ... after I have had my cup of coffie Cheesy
hero member
Activity: 525
Merit: 500
I've upgraded my masternodes to v12.0.49 but I'm still seeing some of them drop off the list after 1-2 hours as EXPIRED. It's strange because the 'expired' masternodes are still active with port open (responding to 'dash-cli getinfo'). Anyone else having this problem?

50% of the time is because you execute the "masternode startt "xxx"" from the cold wallet that is not on the last version.
Aha! I think this was my problem. The cold daemon was still on v12.0.46. Testing now, hopefully they'll stick. Thanks.
hero member
Activity: 826
Merit: 502
.......
Actually, crontabs may require a restart or server reboot.  Might also need to run with sudo crontab -e if running server as root.

..A server I rented didn't have crontab installed so this isn't always a no brainer...

If you don't have crontab installed, try this:

Code:
apt-get update
apt-get upgrade
apt-get install cron
Then you need to reboot for the cron process to take effect.
Add your crontab with crontab -e or sudo crontab -e
Then activate your crontab.  I think sudo service cron restart

Then to stop you need to edit the crontab and then restart the cron service.  Seems more complicated to me.

I don't think so  Roll Eyes

Code:
man crontab
snip
UdjinM6, I do believe the crontab method is indeed the most stable way of doing this and this should work.  I am probably thinking this is harder than it is. But I have struggled in the past to get permissions of the crontab user, file permissions, and directory just right so everything runs.  Just trying to save someone else a little of that time I wasted... 
legendary
Activity: 1834
Merit: 1023
Kudos to jamie and the family
(no Dash)
http://motherboard.vice.com/read/meet-the-bitcoin-family?utm_source=mbfb

"When Jamie Redman’s six-year-old son Joshua loses a tooth, he wakes up to a paper QR code linking to a Bitcoin wallet stuffed under his pillow."
legendary
Activity: 1318
Merit: 1040
.......
Actually, crontabs may require a restart or server reboot.  Might also need to run with sudo crontab -e if running server as root.

..A server I rented didn't have crontab installed so this isn't always a no brainer...

If you don't have crontab installed, try this:

Code:
apt-get update
apt-get upgrade
apt-get install cron
Then you need to reboot for the cron process to take effect.
Add your crontab with crontab -e or sudo crontab -e
Then activate your crontab.  I think sudo service cron restart

Then to stop you need to edit the crontab and then restart the cron service.  Seems more complicated to me.

I don't think so  Roll Eyes

Code:
man crontab
Quote
...
       crontab  is  the  program used to install, deinstall or list the tables used to drive the cron( 8 ) daemon in Vixie Cron.  Each user can have their own crontab, and
       though these are files in /var/spool/cron/crontabs, they are not intended to be edited directly.
...
       For standard Debian systems, all users may use this command.
...

Code:
man cron
Quote
...
       cron searches its spool area (/var/spool/cron/crontabs) for crontab files (which are named after accounts in /etc/passwd); crontabs found are loaded into  memory.
...
       cron  then wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute.
...
       Additionally, cron checks each minute to see if its spool directory's modtime (or the modtime on the /etc/crontab file) has changed, and if it has, cron will then
       examine the modtime on all crontabs files and reload those which have changed.  Thus cron need not be restarted whenever a crontab file is  modified.   Note  that
       the crontab(1) command updates the modtime of the spool directory whenever it changes a crontab.
...
hero member
Activity: 826
Merit: 502
..A server I rented didn't have crontab installed so this isn't always a no brainer...

If you don't have crontab installed, try this:

Code:
apt-get update
apt-get upgrade
apt-get install cron
Then you need to reboot for the cron process to take effect.
Add your crontab with crontab -e or sudo crontab -e
Then activate your crontab.  I think sudo service cron restart

Then to stop you need to edit the crontab and then restart the cron service.  Seems more complicated to me.
hero member
Activity: 671
Merit: 500
..A server I rented didn't have crontab installed so this isn't always a no brainer...

If you don't have crontab installed, try this:

Code:
apt-get update
apt-get upgrade
apt-get install cron
hero member
Activity: 826
Merit: 502
How to start dashd automatically again after it crashed.

run:
Code:
crontab -e

add line:
Code:
*/1 * * * * /home/dashuser/mn_watch.sh >/dev/null 2>&1

use any editor you like and save this as "mn_watch.sh" file in user "dashuser" home directory:
Code:
#!/bin/bash
if [ -z `pidof dashd` ]; then
/home/dashuser/dashd
fi

add executable flag:
Code:
chmod u+x mn_watch.sh


PS. Use appropriate username, not "dashuser" from my example Wink
I also assumed that dashd is located in your user home directory, change path if needed.

PPS. not tested but should work  Roll Eyes

EDIT: ooops, tested and fixed  Smiley

This seems like the perfect solution to my all of my MN problems, But I am 5 and dont understand this, tryed but did not work, Can someone make a video for 5y olds Tongue

Putting a 10 dash bounty on this  Cool .. if anyone is interested Grin

(send me a priv message if you want to collect the bounty, I rarely scan every page here)

No offense, but that's as easy as it gets. The only substitute is using whatever text editor you have on your instance to actually create the script file (vi, nano, joe, etc).
Actually, crontabs may require a restart or server reboot.  Might also need to run with sudo crontab -e if running server as root.  A server I rented didn't have crontab installed so this isn't always a no brainer.

Icebucket, try this:
Copy code below and paste into mn_watch.sh file.  Type nano mn_watch.sh, paste with right click, and control x, y, enter to save.  Change dashuser to your user name.
Code:
#!/bin/bash
#run with:  screen -dm /mn_watch.sh
#stop with:  screen -ls to find number and screen -X -S 11111 kill
while true; do
if [ -z `pidof dashd` ]; then
echo Dashd is not running trying to start
/home/dashuser/dashd
sleep 600
else
echo Dashd is Running
sleep 600
fi
done

type:
chmod +x mn_watch.sh

You can test it by running:
./mn_watch.sh
It will stop working as soon as you logout though, so we need to install screen to have it run in the background.  Run this to install screen.  (Assuming you are running Ubuntu.)
apt-get install screen

to start with  screen type:
screen -dm /mn_watch.sh

This will run forever, so if you want it to stop type
screen -ls and get the number replace that with the 11111 below.
screen -X -S 11111 kill

I set this up to run every 10 minutes, just because it will be a pain if you are updating and every minute it tries to restart dashd.  If you want to run with UdjinM6's suggestion with the crontab start with a */10 for 10 minutes so you don't have to stop the crontab everytime you update your node.
Jump to: