Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 PostJoke

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
18 changes: 18 additions & 0 deletions Masternode/Check-scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#!/bin/bash
HOME=/root
LOGNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/root
latestversion=$(curl --silent https://raw.githubusercontent.com/CommerciumBlockchain/masternode-scripts/master/Masternode/Version | grep '"version":' | sed -E 's/.*"([^"]+)".*/\1/')
localversion=$(cat /usr/local/bin/Masternode/Version | grep '"version":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$latestversion" ] || [ "$latestversion" == "$localversion" ]; then
exit;
else
cd /usr/local/bin/Masternode
rm -f Update-scripts.sh
wget https://raw.githubusercontent.com/CommerciumBlockchain/masternode-scripts/master/Masternode/Update-scripts.sh
bash Update-scripts.sh
fi
13 changes: 13 additions & 0 deletions Masternode/Update-scripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
HOME=/root
LOGNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/root
cd /usr/local/bin/Masternode
rm -f Version
rm -f UpdateNode.sh
wget https://raw.githubusercontent.com/CommerciumBlockchain/masternode-scripts/master/Masternode/UpdateNode.sh
wget https://raw.githubusercontent.com/CommerciumBlockchain/masternode-scripts/master/Masternode/Version
chmod 755 UpdateNode.sh
53 changes: 53 additions & 0 deletions Masternode/UpdateNode.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
HOME=/root
LOGNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/root
LOGFILE='/usr/local/bin/Masternode/update.log'
dt=`date '+%d/%m/%Y %H:%M:%S'`
latestrelease=$(curl --silent https://api.github.com/repos/CommerciumBlockchain/CommerciumContinuum/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
localrelease=$(commercium-cli -version | awk -F' ' '{print $NF}' | cut -d "-" -f1)
if [ -z "$latestrelease" ] || [ "$latestrelease" == "$localrelease" ]; then
echo >> $LOGFILE
echo "[$dt] ==============================================================" >> $LOGFILE
echo "[$dt]==> Info: There is no New Update latest release is $latestrelease" >> $LOGFILE
echo "[$dt] ==============================================================" >> $LOGFILE
exit;
else
echo >> $LOGFILE
echo "[$dt] ==============================================================" >> $LOGFILE
echo "[$dt]==> Info: Starting Update 3DCoin core to $latestrelease" >> $LOGFILE
echo "[$dt] ==============================================================" >> $LOGFILE
cd ~
localfile=${localrelease//[Vv]/CommerciumContinuum-}
echo "[$dt]==> Info: Remove file $localfile" >> $LOGFILE
rm -rf $localfile
link="https://github.com/CommerciumBlockchain/CommerciumContinuum/archive/$latestrelease.tar.gz"
echo "[$dt]==> Info: Download Last Update $link" >> $LOGFILE
wget $link || { echo "[$dt]==> Error: When Download $link" >> $LOGFILE && exit; }
echo "[$dt]==> Info: Extract $latestrelease.tar.gz" >> $LOGFILE
tar -xvzf $latestrelease.tar.gz || { echo "[$dt]==> Error: When Extracting $latestrelease.tar.gz" >> $LOGFILE && exit; }
file=${latestrelease//[Vv]/Commercium-Continuum-}
cd $file || { echo "[$dt]==> Error: File $file not found" >> $LOGFILE && exit; }
echo "[$dt]==> Info: Start Compiling Commercium core $latestrelease" >> $LOGFILE
./zcutil/fetch-params.sh || { echo "[$dt]==> Error: When Compiling Commerciumn core" >> $LOGFILE && exit; }
echo "[$dt]==> Info: Stop Commercium core $localrelease" >> $LOGFILE
commercium-cli stop
sleep 10
echo "[$dt]==> Info: Make install " >> $LOGFILE
./zcutil/build.sh || { echo "[$dt]==> Error: When make install" >> $LOGFILE && exit && commerciumd; }
cd ~
cp $file/src/commerciumd /usr/local/bin
cp $file/src/commercium-cli /usr/local/bin
cp $file/src/commercium-tx /usr/local/bin
cp $file/src/commercium-gtest /usr/local/bin
echo "[$dt]==> Info: Remove $latestrelease.tar.gz" >> $LOGFILE
rm $latestrelease.tar.gz
echo "[$dt]==> Info: Remove $file" >> $LOGFILE
rm -rf $file
echo "[$dt]==> Info: Rebooting " >> $LOGFILE
echo "[$dt] ==============================================================" >> $LOGFILE
reboot
fi
6 changes: 6 additions & 0 deletions Masternode/Version
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "Masternode Commercium",
"version": "1.0.1",
"description": "Bash install & update Masternode Commercium on Ubuntu 16.04 LTS x64"
}

1 change: 1 addition & 0 deletions Masternode/blockcount
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

10 changes: 10 additions & 0 deletions Masternode/clearlog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
HOME=/root
LOGNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/root

/bin/date > ~/.commercium/debug.log

24 changes: 24 additions & 0 deletions Masternode/daemon_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
HOME=/root
LOGNAME=root
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
LANG=en_US.UTF-8
SHELL=/bin/sh
PWD=/root

previousBlock=$(cat /usr/local/bin/Masternode/blockcount)
currentBlock=$(commercium-cli getblockcount)

commercium-cli getblockcount > /usr/local/bin/Masternode/blockcount

if [ "$previousBlock" == "$currentBlock" ]; then
commercium-cli stop
sleep 60
rm -f /root/.Commercium/banlist.dat
rm -f /root/.Commercium/mncache.dat
rm -f /root/.Commercium/mnpayments.dat
rm -f /root/.Commercium/netfulfilled.dat
rm -f /root/.Commercium/debug.log
commerciumd -reindex
fi

Loading