AjM's Simple Commandline Masternode Menu For Linux.
NOTE: Current script is NOT 12.1 compatible !!!
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
Requirements:
dashd and dash-cli location must be in: /usr/bin/
.dash directory must be in user home directory, check pic below.
menu script must be in user home directory, check pic below.
------------------------------------------------------------------------------------------------------------------------
Install:
Copy script below,
create / upload menu file to your user home directory,
and edit variables to match your server.
File need to be saved with in linux, chmod your menu file to 755.
Chmod also /usr/bin/dashd and /usr/bin/dash-cli to 755 if dash is installed already.
Note: If you do not have already dash installed,
this script can install it for you, put the menu script in the user home directory,
edit variables, save and chmod it, start menu and select 1 + enter.
When install is done, proceed with normal masternode setup procedure and configure your dash.conf.
------------------------------------------------------------------------------------------------------------------------
Usage:
To run menu, goto to your user home directory and type ./menu + enter.
Select function/character and press enter.
Just enter will exit menu. Processes exit is ctrl+c or Q.
Tested with Ubuntu Server v15.04.
Note:
Masternode update function (1) will delete following files:
/usr/bin/dashd
/usr/bin/dash-cli
~/.dash/budget.dat
~/.dash/fee_estimates.dat
~/.dash/mncache.dat
~/.dash/mnpayments.dat
~/.dash/peers.dat
~/.dash/wallet.dat (cold wallet, wallet.dat should be empty, no coins)
~/.dash/db.log
~/.dash/debug.log
------------------------------------------------------------------------------------------------------------------------
Script:
You are free to modify this script in anyway you want. Edit variables to match your server.
Change log:
Tips: XnTtWsy4pRWXEG3dXHuvMiPjdeQpLS6ADk
NOTE: Current script is NOT 12.1 compatible !!!
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
Requirements:
dashd and dash-cli location must be in: /usr/bin/
.dash directory must be in user home directory, check pic below.
menu script must be in user home directory, check pic below.
------------------------------------------------------------------------------------------------------------------------
Install:
Copy script below,
create / upload menu file to your user home directory,
and edit variables to match your server.
File need to be saved with in linux, chmod your menu file to 755.
Chmod also /usr/bin/dashd and /usr/bin/dash-cli to 755 if dash is installed already.
Note: If you do not have already dash installed,
this script can install it for you, put the menu script in the user home directory,
edit variables, save and chmod it, start menu and select 1 + enter.
When install is done, proceed with normal masternode setup procedure and configure your dash.conf.
------------------------------------------------------------------------------------------------------------------------
Usage:
To run menu, goto to your user home directory and type ./menu + enter.
Select function/character and press enter.
Just enter will exit menu. Processes exit is ctrl+c or Q.
Tested with Ubuntu Server v15.04.
Note:
Masternode update function (1) will delete following files:
/usr/bin/dashd
/usr/bin/dash-cli
~/.dash/budget.dat
~/.dash/fee_estimates.dat
~/.dash/mncache.dat
~/.dash/mnpayments.dat
~/.dash/peers.dat
~/.dash/wallet.dat (cold wallet, wallet.dat should be empty, no coins)
~/.dash/db.log
~/.dash/debug.log
------------------------------------------------------------------------------------------------------------------------
Script:
You are free to modify this script in anyway you want. Edit variables to match your server.
Code:
#!/bin/bash
# Masternode MENU v1.28 by AjM 3.6.2016
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# USER VARIABLES
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
MNtitle="Masternode 1" #.......... Masternode title
MNbits="linux64" #................ VPS OS is linux64 or linux32
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# MENU VARIABLES
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
MenuVer="v1.28 by AjM" #.......... Menu version
LatestDashVer="" #................ Latest dash.org version
DashVer=$(dash-cli -version | cut -d" " -f6 | cut -d"-" -f1) # Your Dash version
if [ $DashVer = "" ]; then
DashVer="??"
fi
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# Download dash.org/downloads page source -> parse latest version
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
wget -q -O temp.txt https://www.dash.org/downloads/
LatestDashVer=$(grep "Linux 64<" temp.txt > temp2.txt)
LatestDashVer=$(cut -d"-" -f3 temp2.txt)
rm temp.txt && rm temp2.txt
if [ "$LatestDashVer" = "" ]; then
LatestDashVer="? Unknown"
fi
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# UPD_MN: Masternode stop -> download -> update -> start -> getinfo
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
function upd_mn(){
if [ "$LatestDashVer" != "? Unknown" ]; then
echo "Updating masternode" && echo ""
echo "Your Version . . . . "$DashVer && echo "Latest Version . . . v"$LatestDashVer
echo "" && echo "Are you sure? [y]=yes, else cancel"
read ANSWER
if [ "$ANSWER" = "y" ]; then
echo "$LatestDashVer" >> temp.txt && sleep 1
EXTR="dash-"$(cut -d"." -f1,2,3 temp.txt)
DASH="dash-"$LatestDashVer-$MNbits.tar.gz
dash-cli stop && sleep 3
sudo rm /usr/bin/dashd && sudo rm /usr/bin/dash-cli
rm ~/.dash/budget.dat && rm ~/.dash/fee_estimates.dat
rm ~/.dash/mncache.dat && rm ~/.dash/mnpayments.dat
rm ~/.dash/peers.dat && rm ~/.dash/wallet.dat
rm ~/.dash/db.log && rm ~/.dash/debug.log
wget https://www.dash.org/binaries/$DASH
sleep 1 && tar -xvf $DASH && echo "" && sleep 1
sudo mv $EXTR/bin/dashd /usr/bin/dashd
sudo mv $EXTR/bin/dash-cli /usr/bin/dash-cli
sudo chmod +x /usr/bin/dashd && sudo chmod +x /usr/bin/dash-cli
rm -r $DASH* && rm -r $EXTR* && rm temp.txt && sleep 1
echo "Update done" && start_mn
DashVer=$(dash-cli -version | cut -d" " -f6 | cut -d"-" -f1)
if [ $DashVer = "" ]; then
DashVer="??"
fi
else
echo "Update aborted"
fi
else
echo "Error: Latest version info unknown !"
echo "Check your net connection, update aborted !"
fi
}
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# START_MN: Masternode start -> wait 40 sec -> getinfo
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
function start_mn(){
if [ -z `pidof dashd` ]; then
dashd
echo "Wait...." && sleep 10
echo "Wait..." && sleep 10
echo "Wait.." && sleep 10
echo "Wait." && sleep 10 && clear && echo ""
echo "MN getinfo" && dash-cli getinfo
else
echo "Dashd is already running"
fi
}
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# REBOOT_SERVER: Masternode stop -> VPS reboot
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
function reboot_server(){
echo "Reboot VPS server?" && echo "Are you sure? [y]=yes, else cancel"
read ANSWER
if [ "$ANSWER" = "y" ]; then
dash-cli stop && sleep 3
echo "Rebooting VPS" && sudo reboot
else
echo "Reboot aborted"
fi
}
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# LINUX_UPDATE: Masternode stop -> Linux update (optional reboot) -> start
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
function linux_update(){
echo "Update your VPS OS?" && echo "Are you sure? [y]=yes, else cancel"
read ANSWER
if [ "$ANSWER" = "y" ]; then
dash-cli stop && sleep 3
sudo apt-get update && sudo apt-get upgrade && sudo apt-get autoremove && sudo apt-get autoclean
echo "---------------------------------------------------------------"
echo "Update done, do you want reboot your VPS? [y]=yes, else no"
read ANSWER
if [ "$ANSWER" = "y" ]; then
echo "Rebooting VPS" && sudo reboot
else
start_mn
fi
else
echo "OS update aborted"
fi
}
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
# MENU
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
clear && echo ""
selection=
until [ "$selection" = "*" ]; do
if [ -f ~/.dash/debug.log ]; then
dbl_size=$(du -sh ~/.dash/debug.log | cut -f -1) # Debug.log size
else
dbl_size="??"
fi
if [ -z `pidof dashd` ]; then
Dash_running="Stopped"
else
Dash_running="Running"
fi
echo -e "\e[90m----------------------------------\e[0m"
echo -e "\e[36m "$MNtitle"\e[0m\e[90m - Menu $MenuVer\e[0m"
echo -e "\e[90m----------------------------------\e[0m"
if [ "$DashVer" != "v$LatestDashVer" ]; then
echo -e "\e[90m "Your Version . . . . "\e[0m\e[31m"$DashVer"\e[0m"
else
echo -e "\e[90m "Your Version . . . . "\e[0m\e[32m"$DashVer"\e[0m"
fi
echo -e "\e[90m "Latest Version . . . v$LatestDashVer"\e[0m"
echo -e "\e[90m----------------------------------\e[0m"
echo -e "\e[90m Masternode Section\e[0m"
echo -e "\e[90m----------------------------------\e[0m"
echo -e "\e[36m 1\e[0m - Mn Update \e[0m"
echo -e "\e[36m 2\e[0m - Mn Getinfo"
echo -e "\e[36m 3\e[0m - Mn Status\e[0m\e[90m . . . . . $Dash_running\e[0m"
echo -e "\e[36m 4\e[0m - Mn Stop"
echo -e "\e[36m 5\e[0m - Mn Start"
echo -e "\e[36m 6\e[0m - Mn Debug.log errors"
echo -e "\e[36m 7\e[0m - Mn Purge debug.log\e[0m\e[90m . . $dbl_size\e[0m"
echo -e "\e[90m----------------------------------\e[0m"
echo -e "\e[90m Linux Section\e[0m"
echo -e "\e[90m----------------------------------\e[0m"
echo -e "\e[32m m\e[0m - Memory Status"
echo -e "\e[32m d\e[0m - Disk Status"
echo -e "\e[32m f\e[0m - Firewall Status"
echo -e "\e[32m p\e[0m - Processes (Q - Exit)"
echo -e "\e[33m u\e[0m - Linux Update"
echo -e "\e[33m r\e[0m - Reboot VPS Server"
echo -e "\e[90m----------------------------------\e[0m"
echo -e "\e[90m Enter - Exit Menu C - Clear\e[0m"
echo -e "\e[90m----------------------------------\e[0m"
echo -n " >> "
read selection
clear && echo ""
case $selection in
1 ) upd_mn ;;
2 ) echo "MN getinfo" && dash-cli getinfo ;;
3 ) echo "MN status" && dash-cli masternode status ;;
4 ) dash-cli stop && sleep 3 && echo "Done" ;;
5 ) start_mn ;;
6 ) echo "Debug.log errors done" && grep -i -n error ./.dash/debug.log ;;
7 ) truncate ./.dash/debug.log --size 0 && echo "Debug.log purge done" ;;
m ) free -h ;;
d ) df -h ;;
f ) sudo ufw status verbose ;;
p ) top ;;
u ) linux_update ;;
r ) reboot_server ;;
c ) clear ;;
* ) exit ;;
esac
echo ""
done
#¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤
Change log:
Code:
v1.28
FIXED: 'Your version' info did not refresh after masternode update.
FIXED: Masternode update few more bugs.
v1.27
CHANGED: Variable name 'MNno' to 'MNtitle'.
REMOVED: Obsolete funcs.
REMOVED: 'Extract' variable, obsolete because of auto update.
UPDATED: 'masternode update' func removed files.
ADDED: 'Start_mn' func.
ADDED: New menu command, c - clear, clear screen and refersh menu.
ADDED: To 'purge debug.log' row current debug.log filesize info.
Updated every time when menu selection is executed.
ADDED: 'MenuVer', 'DashVer' and 'LatestDashVer' variable.
ADDED: Menu version info to 'MNtitle' row.
ADDED: Dash version info, your current and latest dash.org auto version check.
Version check is done only one time, when menu is started.
If you have latest version, your version color is green, otherwise it is red.
UPDATED: 'masternode update' func, auto update, no manual version input anymore.
ADDED: To 'Mn status' row current dashd status info (Running/Stopped).
Updated every time when menu selection is executed.
UPDATED: Code tidy up.
v1.26
CHANGED: Removed unnecessary 'Sleep' commands.
CHANGED: Typo 'Mn clear debug.log' -> 'Mn purge debug.log'.
ADDED: Info text 'Debug.log purge done' to debug.log purge func.
v1.25
FIXED: Typo (func title) 'MN reboot' -> 'VPS reboot'.
ADDED: 'Masternode section' and 'Linux section' titles.
ADDED: Linux update function with MN stop first, ask reboot vps, if no dashd restarted.
ADDED: Reboot server function info text -> 'Rebooting VPS...'
CHANGED: Menu selection title 'Reboot server' -> 'Reboot VPS server'
v1.24
Added some colors and some design changes to the menu.
Moved 'Extract' variable to the top (extracted folder from tar.gz),
fix this when new major version is released or tar.gz extracted folder is changed.
Added to 'Linux update' command 'apt-get autoremove' and 'apt-get autoclean'.
Added new command 'Mn debug.log errors', print all debug.log errors.
Added new command 'Mn clear debug.log', clear debug.log, file not removed.
v1.23
Fixed official web address dashpay.io -> dash.org.
v1.22
Added server reboot function which have a user confirmation and proper dash mn stop.
v1.21
MN status changed to (dash-cli masternode status).
Removed MNip, its not needed any more, because of new MN status.
Tips: XnTtWsy4pRWXEG3dXHuvMiPjdeQpLS6ADk
Last edited: