forked from edelweiscoin/masternode-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmasternodeinstall.sh
106 lines (93 loc) · 2.58 KB
/
masternodeinstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
PORT=41010
RPCPORT=41011
CONF_DIR=~/.edelweis
COINZIP='https://github.com/edelweiscoin/EDEL/releases/download/v1.1/edelweis-linux.zip'
cd ~
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
if [[ $EUID -ne 0 ]]; then
echo -e "${RED}$0 must be run as root.${NC}"
exit 1
fi
function configure_systemd {
cat << EOF > /etc/systemd/system/edelweis.service
[Unit]
Description=Edelweis Service
After=network.target
[Service]
User=root
Group=root
Type=forking
ExecStart=/usr/local/bin/edelweisd -datadir=/data/edel
ExecStop=-/usr/local/bin/edelweis-cli -datadir=/data/edel stop
Restart=always
PrivateTmp=true
TimeoutStopSec=60s
TimeoutStartSec=10s
StartLimitInterval=120s
StartLimitBurst=5
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
sleep 2
systemctl enable edelweis.service
systemctl start edelweis.service
}
echo ""
echo ""
DOSETUP="y"
if [ $DOSETUP = "y" ]
then
apt-get update
apt install zip unzip git curl wget -y
cd /usr/local/bin/
wget $COINZIP
unzip *.zip
rm edelweis-qt edelweis-tx edelweis-linux.zip
chmod +x edelweis*
mkdir -p $CONF_DIR
cd $CONF_DIR
wget http://cdn.delion.xyz/edel.zip
unzip edel.zip
rm edel.zip
fi
IP=$(curl -s4 api.ipify.org)
echo ""
echo "Configure your masternodes now!"
echo "Detecting IP address:$IP"
echo ""
echo "Enter masternode private key"
read PRIVKEY
echo "rpcuser=user"`shuf -i 100000-10000000 -n 1` >> edelweis.conf_TEMP
echo "rpcpassword=pass"`shuf -i 100000-10000000 -n 1` >> edelweis.conf_TEMP
echo "rpcallowip=127.0.0.1" >> edelweis.conf_TEMP
echo "rpcport=$RPCPORT" >> edelweis.conf_TEMP
echo "listen=1" >> edelweis.conf_TEMP
echo "server=1" >> edelweis.conf_TEMP
echo "daemon=1" >> edelweis.conf_TEMP
echo "maxconnections=250" >> edelweis.conf_TEMP
echo "masternode=1" >> edelweis.conf_TEMP
echo "" >> edelweis.conf_TEMP
echo "port=$PORT" >> edelweis.conf_TEMP
echo "externalip=$IP:$PORT" >> edelweis.conf_TEMP
echo "masternodeaddr=$IP:$PORT" >> edelweis.conf_TEMP
echo "masternodeprivkey=$PRIVKEY" >> edelweis.conf_TEMP
mv edelweis.conf_TEMP edelweis.conf
cd
echo ""
echo -e "Your ip is ${GREEN}$IP:$PORT${NC}"
## Config Systemctl
configure_systemd
echo ""
echo "Commands:"
echo -e "Start Edelweis Service: ${GREEN}systemctl start edelweis${NC}"
echo -e "Check Edelweis Status Service: ${GREEN}systemctl status edelweis${NC}"
echo -e "Stop Edelweis Service: ${GREEN}systemctl stop edelweis${NC}"
echo -e "Check Masternode Status: ${GREEN}edelweis-cli getmasternodestatus${NC}"
echo ""
echo -e "${GREEN}Edelweis Masternode Installation Done${NC}"
exec bash
exit