Solarminer
|
|
August 26, 2015, 11:19:46 PM Last edit: August 26, 2015, 11:35:10 PM by Solarminer |
|
How to start dashd automatically again after it crashed. run: add line: */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: #!/bin/bash if [ -z `pidof dashd` ]; then /home/dashuser/dashd fi
add executable flag: PS. Use appropriate username, not "dashuser" from my example I also assumed that dashd is located in your user home directory, change path if needed. PPS. not tested but should work EDIT: ooops, tested and fixed 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 Putting a 10 dash bounty on this .. if anyone is interested (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. #!/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.
|
|
|
|
oaxaca
|
|
August 26, 2015, 11:33:37 PM |
|
..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: apt-get update apt-get upgrade apt-get install cron
|
|
|
|
Solarminer
|
|
August 26, 2015, 11:41:54 PM |
|
..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: 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.
|
|
|
|
UdjinM6
Legendary
Offline
Activity: 1318
Merit: 1040
|
|
August 26, 2015, 11:51:22 PM |
|
....... 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: 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 ... 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. ...
... 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. ...
|
DASH: XsV4GHVKGTjQFvwB7c6mYsGV3Mxf7iser6
|
|
|
|
Solarminer
|
|
August 27, 2015, 01:21:46 AM |
|
....... 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: 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 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...
|
|
|
|
HinnomTX
|
|
August 27, 2015, 02:29:46 AM |
|
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.
|
"One can only solve so much with cryptography. The rest of the solution will prove to be economic in nature." -Evan Duffield Dash is Digital Cash. https://www.dash.org
|
|
|
Icebucket
|
|
August 27, 2015, 03:33:43 AM |
|
....... 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: 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 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
|
“Every morning we are born again. What we do today is what matters most.” ― Gautama Buddha
|
|
|
TanteStefana2
Legendary
Offline
Activity: 1260
Merit: 1001
|
|
August 27, 2015, 03:36:11 AM |
|
How to start dashd automatically again after it crashed. run: add line: */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: #!/bin/bash if [ -z `pidof dashd` ]; then /home/dashuser/dashd fi
add executable flag: PS. Use appropriate username, not "dashuser" from my example I also assumed that dashd is located in your user home directory, change path if needed. PPS. not tested but should work EDIT: ooops, tested and fixed 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?
|
Another proud lifetime Dash Foundation member My TanteStefana account was hacked, Beware trading "You'll never reach your destination if you stop to throw stones at every dog that barks."Sir Winston Churchill BTC: 12pu5nMDPEyUGu3HTbnUB5zY5RG65EQE5d
|
|
|
UdjinM6
Legendary
Offline
Activity: 1318
Merit: 1040
|
|
August 27, 2015, 03:42:22 AM |
|
I don't think so 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. 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 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.
|
DASH: XsV4GHVKGTjQFvwB7c6mYsGV3Mxf7iser6
|
|
|
UdjinM6
Legendary
Offline
Activity: 1318
Merit: 1040
|
|
August 27, 2015, 03:49:32 AM Last edit: August 27, 2015, 01:35:08 PM by UdjinM6 |
|
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 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: #!/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: chmod u+x install_dash_qt.sh to make file executable and 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! PS. This script reguires wget. Install it first if you don't have it already 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
|
DASH: XsV4GHVKGTjQFvwB7c6mYsGV3Mxf7iser6
|
|
|
snogcel
|
|
August 27, 2015, 04:00:28 AM |
|
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 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: #!/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: chmod u+x install_dash_qt.sh to make file executable and 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! PS. This script reguires wget. Install it first if you don't have it already sudo apt-get install wget Nice! That worked like a charm
|
XuvjV4aazgZhcfAj1KRgFnTok1pZZw6Ewu
|
|
|
Bridgewater
|
|
August 27, 2015, 05:35:24 AM |
|
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.
|
|
|
|
moocowmoo
|
|
August 27, 2015, 05:43:05 AM |
|
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/dashmanAnd let me know if you run into trouble!
|
|
|
|
Solarminer
|
|
August 27, 2015, 05:58:59 AM |
|
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.
|
|
|
|
moocowmoo
|
|
August 27, 2015, 06:53:59 AM |
|
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. */1 * * * * [ -f /home/dashuser/.dash/dashd_enable ] && /home/dashuser/mn_watch.sh >/dev/null 2>&1 Then you can ignore cron and just do touch ~/.dash/dashd_enable to monitor/auto-restart and 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. #!/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 */1 * * * * [ -f /home/dashuser/.dash/dashd_enable ] && /home/dashuser/mn_watch.sh >/home/dashuser/mn_watch.log 2>&1
|
|
|
|
Rux
Legendary
Offline
Activity: 1291
Merit: 1024
https://crypto.ba
|
|
August 27, 2015, 06:59:19 AM |
|
Guys if you continue like that... one day we will have Autoupdating, Autostarting, Autorestarting, self-sustainable MNs Me like it
|
RXC Crypto.ba Decentralized solutions!
|
|
|
Sub-Ether
Sr. Member
Offline
Activity: 434
Merit: 250
Quantum entangled and jump drive assisted messages
|
|
August 27, 2015, 07:07:24 AM |
|
|
Dash is 27.3 times faster with syncing and updating than Bitcoin and 93.7 times faster than Monero. Bitcoin (v0.11.0) has a Tao ratio 11.2% faster than bitcoin (v0.10.0) release. Dash (v.0.12.0.49) = Tao sync ratio = 0.15 seconds / hour of update || Dash (v.0.11.2.23) = Tao sync ratio = 0.24 seconds / hour of update. V12 versus V11 speedup = +36.5% Bitcoin (v.0.11.0) = Tao sync ratio = 4.14 seconds / hour of update || Monero (v.0.41.1) = Tao sync ratio = 14.2 seconds / hour of update
|
|
|
moocowmoo
|
|
August 27, 2015, 07:32:39 AM |
|
Guys if you continue like that... one day we will have Autoupdating, Autostarting, Autorestarting, self-sustainable MNs Me like it Nothing replaces having a full-time admin with a monitoring network.
|
|
|
|
110110101
Legendary
Offline
Activity: 1382
Merit: 1002
|
|
August 27, 2015, 07:35:35 AM |
|
....
Just wanted to give you a special thanks mate! Your scripts are going to be lifesavers for many happy masternode users
|
|
|
|
|