delete

DrkMiner

Member
Jun 7, 2014
204
63
88
I used the code above and improved it a bit...

Code:
#!/bin/sh
echo "########### This script will update the Master Node"
sleep 5
VERSION=64
URL=$1
FILE=${URL##*/}
DIR=${FILE%.tar.gz}
IP=$(hostname -I)
wget $URL
tar xzvf $FILE
echo "########### Stopping the Master Node"
./darkcoind stop
sleep 7
rm darkcoind
cp $DIR/bin/$VERSION/darkcoind .
chmod 755 darkcoind
rm $FILE
rm -rf $DIR
rm .darkcoin/peers.dat
echo "########### Restarting the updated Master Node"
sleep 5
./darkcoind
sleep 15
./darkcoind getinfo
sleep 5
echo "########### Master Node status - Active: 1, Inctive: 0"
./darkcoind masternode list | grep $IP
save as update.sh and chomd 755
run from SSH:
./update.sh https://raw.githubusercontent.com/d...es/master/rc/darkcoin-0.10.12.32-linux.tar.gz

link to the new/update tar.gz file will be available on Darkcoin.io

If HOT wallet is used on the MN a new wallet is needed to upgrade to the new RC5.
 
Last edited by a moderator:

DrkMiner

Member
Jun 7, 2014
204
63
88
echo "########### Restarting the updated Master Node"
sleep 5
./darkcoind
sleep 30
./darkcoind getinfo
sleep 20
echo "########### Master Node status - Active: 1, Inctive: 0"
./darkcoind masternode list | grep $IP

In some cases you will need to increase the "sleep" time to give darkcoind more time to fully load.
 

tungfa

Administrator
Dash Core Team
Moderator
Foundation Member
Masternode Owner/Operator
Apr 9, 2014
8,890
6,717
1,283
that is great,
can you please post a final version in the OP ?!
tx
 

camosoul

Grizzled Member
Sep 19, 2014
2,265
1,130
1,183
...you generally do not have to execute the masternode start command on the remote machine.
Oh, contrariwise; you most absolutely must without exception, always. The new daemon will not know it is an MN in spite of there being such in the config. Without a "masternode start" it will just sit there, never ping the network, become inactive, then drop off the list entirely, and when using start-many, that's a pain to deal with... Ask me how I know this...

Even when you do a "masternode start" it often does not stick and has to be re-issued over and over and over again until you see "last seen" reset on it's own, without issuing the "masternode start" command. Just keep doing "masternode start" until the daemon starts pinging, or you're going to have one hell of a mess and probably be forced to destroy all your VMs, move all your DRK to new addresses, and start over completely.
 
Last edited by a moderator:

moocowmoo

Bovine Bit-flipper
Foundation Member
Jun 15, 2014
483
603
263
masternode.me
Dash Address
XmoocowYfrPKUR6p6M5aJZdVntQe71irCX
my "hat in the ring" version. Note: hardcoded for 64bit linux... YMWV


Code:
#!/bin/bash

GETURL=https://raw.githubusercontent.com/darkcoinproject/darkcoin-binaries/master/

if [ -z $1 ] ; then
    echo "usage: $0 darkcoinversion"
    echo "eg: $0 0.10.16.16"
    exit
fi

version=$1

GETFILE=darkcoin-${version}-linux.tar.gz
GETURL=${GETURL}${GETFILE}

if [ ! -e $GETFILE ] ; then
    wget $GETURL
fi

if [ ! -e $GETFILE ] ; then
    echo "error downloading file"
    echo "tried to get ${GETURL}"
    exit
fi

#unpack it
tar zxvf $GETFILE

#copy it
cp darkcoin-${version}-linux/bin/64/darkcoind ~/.darkcoin/darkcoind-${version}

#remove unneeded
rm -rf darkcoin-${version}-linux

#work it
cd ~/.darkcoin

#stop it
darkcoind stop

#wait it
sleep 5

#clean it
rm -f debug.log peers.dat

#link it
rm darkcoind && ln -s darkcoind-${version} darkcoind

#start it
./darkcoind &
Brittle, could use more error handling... but as long as the directory/filename structures remain consistent... should work until it doesn't.

:)
 

UdjinM6

Official Dash Dev
Dash Core Team
Moderator
May 20, 2014
3,638
3,538
1,183
Ok, here is mine :)
Code:
#!/bin/bash
date

if [ $1 ]; then
DARK=darkcoin-$1-linux
wget https://github.com/darkcoinproject/darkcoin-binaries/raw/master/$DARK.tar.gz
tar -xvf $DARK.tar.gz
chmod u+x $DARK/bin/64/darkcoind
else
cd ~/darkcoin/
git pull
cd src/
make -f makefile.unix USE_UPNP=-
fi

darkcoind stop
sleep 5
mv /usr/bin/darkcoind /usr/bin/darkcoind.old

if [ $1 ]; then
mv $DARK/bin/64/darkcoind /usr/bin/
rm -r $DARK*
else
cp darkcoind /usr/bin/
fi

darkcoind
Usage is
Code:
./mn_update.sh 0.10.16.16
to get binaries of exact version or
Code:
./mn_update.sh
to get latest github commit and compile by yourself (you have to have all needed dev libs installed first of course)
 

oblox

Well-known Member
Aug 6, 2014
1,032
537
183
You only need to issue a masternode start from local assuming the remote masternode isn't offline for too long to drop off the list on protocol bumps. If the protocol stays the same, using anyone of these update scripts to stop the remote masternode for about 30-60 seconds while updating won't require you to load the local wallet up.
 

tungfa

Administrator
Dash Core Team
Moderator
Foundation Member
Masternode Owner/Operator
Apr 9, 2014
8,890
6,717
1,283
Hi,
I have not seen any masternode update script, so I want to share my simple one.
This is for local-remote setup. This script should be run on the remote server for masternode update. You only have to restart masternode on the local machine, when there was a protocol version update.

If you have more than one masternode/server, you can use "superputty" to execute the update command simultaneous on all remote machines: https://code.google.com/p/superputty/

Code:
#!/bin/sh
echo "########### This script will update the Master Node"
sleep 5
VERSION=64
URL=$1
FILE=${URL##*/}
DIR=${FILE%.tar.gz}
cd ~/.dash
wget $URL
tar xzvf $FILE
echo "########### Stopping the Master Node"
./dashd stop
sleep 4
rm dashd
cp $DIR/bin/$VERSION/dashd .
chmod 755 dashd
rm $FILE
rm -rf $DIR
rm peers.dat debug.log db.log
echo "########### Restarting the updated Master Node"
sleep 2
./dashd
you need to add the url for the new darkcoin (tar.gz compressed) binary as argument e. g. "sh update.sh https://www.dashpay.io/binaries/dash-0.11.1.26-linux.tar.gz"
place the code inside ~/.dash/update.sh and chmod 755 update.sh
for it to work you need a symbolic link from /usr/bin/dashd to ~/.dash/dashd: "sudo ln -s ~/.dash/dashd /usr/bin/"

cheers,

EDIT: added status message output and "rm peers.dat debug.log db.log" command (thanks DrkMiner)
EDIT2: added superputty advice (thanks oblox)
EDIT3: updated for new name "dash"
Can you please start working on "rebranding" the guide ?!
that would be great and super appreciated
Tx
 

BolehVPN

Active Member
Nov 24, 2014
195
306
123
Hi :D I have updated the script but it requires 'bash'
it's a bit of a hacky way so I'm open to how to improve it (I'm not a programmer)

For upgrading to v12.

#!/bin/bash
echo "########### This script will update the Master Node"
sleep 5
URL=$1
FILE=${URL##*/}
DIR=${FILE:0:11}
cd ~/.dash
wget $URL
tar xzvf $FILE
echo "########### Stopping the Master Node"
./dashd stop
sleep 5
rm dashd
cp $DIR/bin/dashd .
cp $DIR/bin/dash-cli .
chmod 755 dashd
rm $FILE
rm -rf $DIR
rm peers.dat debug.log db.log
echo "########### Restarting the updated Master Node"
sleep 2
./dashd -reindex

Once on v12 and future updates (provided no more changes in directory structure)

#!/bin/bash
echo "########### This script will update the Master Node"
sleep 5
URL=$1
FILE=${URL##*/}
DIR=${FILE:0:11}
cd ~/.dash
wget $URL
tar xzvf $FILE
echo "########### Stopping the Master Node"
./dash-cli stop
sleep 5
rm dashd
cp $DIR/bin/dashd .
cp $DIR/bin/dash-cli .
chmod 755 dashd
rm $FILE
rm -rf $DIR
rm peers.dat debug.log db.log
echo "########### Restarting the updated Master Node"
sleep 2
./dashd
 

moocowmoo

Bovine Bit-flipper
Foundation Member
Jun 15, 2014
483
603
263
masternode.me
Dash Address
XmoocowYfrPKUR6p6M5aJZdVntQe71irCX
For all you folks running version 12 on linux:

https://github.com/moocowmoo/dashman

(Read the README, this script places the executables in ~/.dash -- I'll add destination folders eventually.)



Let me know if you run into any trouble. I'll push bugfixes as we find them. ;)

(32bit install untested, but should work, lmk)
 
Last edited by a moderator:

Solaso

Member
Aug 20, 2015
134
20
68
Hi :D I have updated the script but it requires 'bash'
it's a bit of a hacky way so I'm open to how to improve it (I'm not a programmer)

For upgrading to v12.

#!/bin/bash
echo "########### This script will update the Master Node"
sleep 5
URL=$1
FILE=${URL##*/}
DIR=${FILE:0:11}
cd ~/.dash
wget $URL
tar xzvf $FILE
echo "########### Stopping the Master Node"
./dashd stop
sleep 5
rm dashd
cp $DIR/bin/dashd .
cp $DIR/bin/dash-cli .
chmod 755 dashd
rm $FILE
rm -rf $DIR
rm peers.dat debug.log db.log
echo "########### Restarting the updated Master Node"
sleep 2
./dashd -reindex

Once on v12 and future updates (provided no more changes in directory structure)

#!/bin/bash
echo "########### This script will update the Master Node"
sleep 5
URL=$1
FILE=${URL##*/}
DIR=${FILE:0:11}
cd ~/.dash
wget $URL
tar xzvf $FILE
echo "########### Stopping the Master Node"
./dash-cli stop
sleep 5
rm dashd
cp $DIR/bin/dashd .
cp $DIR/bin/dash-cli .
chmod 755 dashd
rm $FILE
rm -rf $DIR
rm peers.dat debug.log db.log
echo "########### Restarting the updated Master Node"
sleep 2
./dashd
Thank you. Please tell me, can I add this to autoload and add to crontab?
 

moocowmoo

Bovine Bit-flipper
Foundation Member
Jun 15, 2014
483
603
263
masternode.me
Dash Address
XmoocowYfrPKUR6p6M5aJZdVntQe71irCX
Please tell me about work on Ubuntu?
It will work fine on ubuntu.

It is meant to be run manually.

It expects your dashd and dash-cli be in your ~/.dash folder.
(I'm working on making that part smarter for alternate layouts.)
 
  • Like
Reactions: Solaso

moocowmoo

Bovine Bit-flipper
Foundation Member
Jun 15, 2014
483
603
263
masternode.me
Dash Address
XmoocowYfrPKUR6p6M5aJZdVntQe71irCX
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!
 

DarkWater

Well-known Member
Foundation Member
May 14, 2014
111
98
193
5280, Colorado
www.meetup.com
This update script rocks! Just switched over to this and it went smooth as butter. Now if I can figure out why I can't successfully resync to the network. Block height matches but doesn't show up on the list.
 

Solaso

Member
Aug 20, 2015
134
20
68
Thank you, in manual I see error
for it to work you need a symbolic link from /usr/bin/dashd to ~/.dash/dashd: "sudo ln -s ~/.dash/dashd /usr/bin/" and same for dash-cli "sudo ln -s ~/.dash/dashd /usr/bin/"

Double sudo ln -s ~/.dash/dashd /usr/bin/ may be one sudo ln -s ~/.dash/dash-cli /usr/bin/"
 

Solaso

Member
Aug 20, 2015
134
20
68
For all you folks running version 12 on linux:

https://github.com/moocowmoo/dashman

(Read the README, this script places the executables in ~/.dash -- I'll add destination folders eventually.)



Let me know if you run into any trouble. I'll push bugfixes as we find them. ;)

(32bit install untested, but should work, lmk)
[email protected]:/home/user1/dashman# ./update_dashd.sh
readlink: missing operand
Try 'readlink --help' for more information.
dashd not found in -- Exiting.

On my server dashd upper folder dash. Where I wrong? Thank you
 

moocowmoo

Bovine Bit-flipper
Foundation Member
Jun 15, 2014
483
603
263
masternode.me
Dash Address
XmoocowYfrPKUR6p6M5aJZdVntQe71irCX
[email protected]:/home/user1/dashman# ./update_dashd.sh
readlink: missing operand
Try 'readlink --help' for more information.
dashd not found in -- Exiting.

On my server dashd upper folder dash. Where I wrong? Thank you
update_dashd.sh looks in three places for dash-cli and dashd:
  • the current directory
  • ~/.dash
  • all directories in your PATH variable
In your case, do:
Code:
cd ~/dash
../dashman/update_dashd.sh
and it should work. Let me know if you have more trouble.
 

Solaso

Member
Aug 20, 2015
134
20
68
Yes) I started this

[email protected]:/$ cd ~/
[email protected]:~$ dashman/update_dashd.sh

But I see finished install

Installed in /home/user1

-rw-rw-r-- 1 19892539 Sep 4 18:10 dash-0.12.0.53-linux64.tar.gz
-rw-rw-r-- 1 186 Sep 4 18:10 dash-0.12.0.53-linux64.tar.gz.DIGESTS.txt
lrwxrwxrwx 1 18 Sep 5 19:59 dash-cli -> dash-cli-0.12.0.53
-rwxr-xr-x 1 2548784 Jan 10 2014 dash-cli-0.12.0.53
lrwxrwxrwx 1 15 Sep 5 19:59 dashd -> dashd-0.12.0.53
-rwxr-xr-x 1 9423200 Jan 10 2014 dashd-0.12.0.53
lrwxrwxrwx 1 17 Sep 5 19:59 dash-qt -> dash-qt-0.12.0.53
-rwxr-xr-x 1 13339504 Jan 10 2014 dash-qt-0.12.0.53

Its right? Or now I should to rename dashd-0.12.0.53 to dashd?
 

moocowmoo

Bovine Bit-flipper
Foundation Member
Jun 15, 2014
483
603
263
masternode.me
Dash Address
XmoocowYfrPKUR6p6M5aJZdVntQe71irCX
Yes) I started this

[email protected]:/$ cd ~/
[email protected]:~$ dashman/update_dashd.sh

But I see finished install

Installed in /home/user1

-rw-rw-r-- 1 19892539 Sep 4 18:10 dash-0.12.0.53-linux64.tar.gz
-rw-rw-r-- 1 186 Sep 4 18:10 dash-0.12.0.53-linux64.tar.gz.DIGESTS.txt
lrwxrwxrwx 1 18 Sep 5 19:59 dash-cli -> dash-cli-0.12.0.53
-rwxr-xr-x 1 2548784 Jan 10 2014 dash-cli-0.12.0.53
lrwxrwxrwx 1 15 Sep 5 19:59 dashd -> dashd-0.12.0.53
-rwxr-xr-x 1 9423200 Jan 10 2014 dashd-0.12.0.53
lrwxrwxrwx 1 17 Sep 5 19:59 dash-qt -> dash-qt-0.12.0.53
-rwxr-xr-x 1 13339504 Jan 10 2014 dash-qt-0.12.0.53

Its right? Or now I should to rename dashd-0.12.0.53 to dashd?
If that's where you wanted it installed, sure.
No need to rename, it's symlinked. ./dashd and ./dash-cli will just work.
 
  • Like
Reactions: Solaso

Solaso

Member
Aug 20, 2015
134
20
68
Thank you! Can I start this in cron? For example once in week?
 
Last edited by a moderator: